的comment-author-[USER-ID]
或[USER-NICKNAME]
类可以通过使用WordPress的去除comment_class
滤波器钩。
这样就得到:
/**
* Filters the returned CSS classes for the current comment.
*
* @since 2.7.0
*
* @param string[] $classes An array of comment classes.
* @param string $class A comma-separated list of additional classes added to the list.
* @param int $comment_id The comment ID.
* @param WP_Comment $comment The comment object.
* @param int|WP_Post $post_id The post ID or WP_Post object.
*/
function filter_comment_class( $classes, $class, $comment_id, $comment, $post_id ) {
// Loop through classes
foreach ( $classes as $key => $class ) {
// Check if a string contains a specific word
if ( strpos( $class, 'comment-author') !== false ) {
// Unset a given variable
unset( $classes[$key] );
}
}
return $classes;
}
add_filter( 'comment_class', 'filter_comment_class', 10, 5 );
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句