#wordpress #woocommerce #frontend #review #hook-wordpress
#wordpress #woocommerce #интерфейс #обзор #хук-wordpress
Вопрос:
Ответ №1:
Класс comment-author-[USER-ID]
or [USER-NICKNAME]
можно удалить с помощью comment_class
фильтра WordPress.
Таким образом, вы получаете:
/**
* 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 );