How do I override the emoji url?

When you enable emojis, Wordpress includes code which converts the chars to the PNGs which it pulls from a CDN.

We would like to replace those with our own images.

According to formatting.php the function is here.

How do we override the emoj_url so that we are pulling the PNGs from a folder of our choosing? Can the function being replaced (ie. is it pluggable?) I tried remove_all_filters() and apply_filter() with our own function, but it doesn't work.

Topic emoji urls Wordpress

Category Web


Looking at the code, you should be able to filter it. Something like the following should do it:

add_filter( 'emoji_url', 'wpse_232874_emoji_cdn_url' );
function wpse_232874_emoji_cdn_url( $url ) {
    return 'http://example.com/my/cdn/url/';
}

...replacing http://example.com/my/cdn/url/ with whatever URL you want to use.

Reference

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.