如何从WooCommerce评论部分删除comment-author- [USER-ID]类?

马吉德·纳西林贾德(Majid Nasirinejad)

有谁知道如何从woocommerce评论部分中删除突出显示的类?

在此处输入图片说明

7uc1f3r

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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

基于Django类的CreateApiView author_id不为null?

来自分类Dev

Woocommerce Products by Author

来自分类Dev

Laravel 5说:““字段列表”中的未知列“ user_id””,但是我有“ author_id”

来自分类Dev

如何显示使用{%if user.is_authenticated == post.author%}创建的帖子用户?

来自分类Dev

如何显示使用{%if user.is_authenticated == post.author%}创建的帖子用户?

来自分类Dev

/ posts / 12 / new-comment / NOT NULL约束处的IntegrityError失败:posts_comment.author_id

来自分类Dev

Netbeans:在现有类上更新@author?

来自分类Dev

如何在author.php中回显Wordpress作者ID?

来自分类Dev

如何在author.php中回显Wordpress作者ID?

来自分类Dev

通过类名(ReactJS)隐藏的Facebook Social Plugins评论部分

来自分类Dev

通过类名(ReactJS)隐藏的Facebook Social Plugins评论部分

来自分类Dev

如何通过user_id的隐藏字段进行评论?

来自分类Dev

git create stash无需配置user.email和user.name(git stash --author?)

来自分类Dev

/ post / new /处的ValueError无法分配“ <SimpleLazyObject:<User:chetan >>”:“ Post.author”必须是“ User”实例

来自分类Dev

discord.py message.author.id返回追溯

来自分类Dev

如何使用SED替换评论部分中的评论

来自分类Dev

我如何才能强制prod用户提交--author <the_real_author>

来自分类Dev

对象/类ID如何工作?

来自分类Dev

Rails-如何在帖子评论中插入user_id?

来自分类Dev

Youtube如何生成共享和评论部分

来自分类Dev

如何在wordpress评论部分隐藏行?

来自分类Dev

如何为应用程序创建评论部分

来自分类Dev

如何从winrar文件cli读取评论部分

来自分类Dev

注意:未定义的索引:comment_author

来自分类Dev

如何在PyCharm中编辑默认的__author__ = name行

来自分类Dev

如何创建author-custom_type.php并重写规则?

来自分类Dev

如何反转git log --author = me?(不使用Perl)

来自分类Dev

如何反转git log --author = me?(不使用Perl)

来自分类Dev

Google App Engine-为什么用户类user_id与Googleapis id不同

Related 相关文章

  1. 1

    基于Django类的CreateApiView author_id不为null?

  2. 2

    Woocommerce Products by Author

  3. 3

    Laravel 5说:““字段列表”中的未知列“ user_id””,但是我有“ author_id”

  4. 4

    如何显示使用{%if user.is_authenticated == post.author%}创建的帖子用户?

  5. 5

    如何显示使用{%if user.is_authenticated == post.author%}创建的帖子用户?

  6. 6

    / posts / 12 / new-comment / NOT NULL约束处的IntegrityError失败:posts_comment.author_id

  7. 7

    Netbeans:在现有类上更新@author?

  8. 8

    如何在author.php中回显Wordpress作者ID?

  9. 9

    如何在author.php中回显Wordpress作者ID?

  10. 10

    通过类名(ReactJS)隐藏的Facebook Social Plugins评论部分

  11. 11

    通过类名(ReactJS)隐藏的Facebook Social Plugins评论部分

  12. 12

    如何通过user_id的隐藏字段进行评论?

  13. 13

    git create stash无需配置user.email和user.name(git stash --author?)

  14. 14

    / post / new /处的ValueError无法分配“ <SimpleLazyObject:<User:chetan >>”:“ Post.author”必须是“ User”实例

  15. 15

    discord.py message.author.id返回追溯

  16. 16

    如何使用SED替换评论部分中的评论

  17. 17

    我如何才能强制prod用户提交--author <the_real_author>

  18. 18

    对象/类ID如何工作?

  19. 19

    Rails-如何在帖子评论中插入user_id?

  20. 20

    Youtube如何生成共享和评论部分

  21. 21

    如何在wordpress评论部分隐藏行?

  22. 22

    如何为应用程序创建评论部分

  23. 23

    如何从winrar文件cli读取评论部分

  24. 24

    注意:未定义的索引:comment_author

  25. 25

    如何在PyCharm中编辑默认的__author__ = name行

  26. 26

    如何创建author-custom_type.php并重写规则?

  27. 27

    如何反转git log --author = me?(不使用Perl)

  28. 28

    如何反转git log --author = me?(不使用Perl)

  29. 29

    Google App Engine-为什么用户类user_id与Googleapis id不同

热门标签

归档