1

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.

3

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

  • That gets me most of the way there. What's weird is that the ALT tag is still replaced with the default pngs. – jchwebdev Jul 21 '16 at 19:06
  • From what I can see, the alt text isn't filterable. You may be stuck there. – Pat J Jul 21 '16 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.