admin管理员组文章数量:1420086
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 badges1 Answer
Reset to default 2To 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
本文标签: Check if emojis is disabled
版权声明:本文标题:Check if emojis is disabled 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745319743a2653323.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论