最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Check if emojis is disabled

programmeradmin1浏览0评论

How can check if the emoji is disabled on the site or not?

I have searched for an official function but I haven't found anything officially, We are creating a theme and will publish it soon and need to check if the customer has disabled the emojis by adding any function or by any another way.

How can check if the emoji is disabled on the site or not?

I have searched for an official function but I haven't found anything officially, We are creating a theme and will publish it soon and need to check if the customer has disabled the emojis by adding any function or by any another way.

Share Improve this question asked Jul 15, 2019 at 19:58 GeorgeGeorge 233 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

To completely remove emojis this is the code:

    remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); 
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); 
    remove_action( 'wp_print_styles', 'print_emoji_styles' ); 
    remove_action( 'admin_print_styles', 'print_emoji_styles' );

So to check if any of those are active you could use has_action() like this:

    $emoji_script front = has_action( 'wp_head', 'print_emoji_detection_script' );
    if( $emoji_script_front ) {
      // The emoji script is loaded on the front end
    } 

You could do different things for each of the actions. has_action does not care about priority, and this should work in the functions.php file since it runs later than all of those actions.

More about has_action() on WordPress

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论