PHP snippet · Performance

Disable emojis

Removes the emoji polyfill script, stylesheet, and DNS prefetch that WordPress loads on every page. Your emoji still work.

About this php snippet

WordPress prints an emoji detection script and a stylesheet on every page, front end and admin, so that older browsers can render emoji as images instead. Every browser in use today renders emoji natively, so this is pure weight on every single request.

Removing it does not stop emoji working in your content. It only removes the polyfill that nobody needs any more.

What it does

  • Removes the emoji detection script from the page head, from embeds, and from the admin
  • Removes the emoji stylesheet on both the front end and the admin
  • Stops emoji being converted to images in feeds and in outgoing mail
  • Drops the emoji plugin from the classic editor's TinyMCE build
  • Removes the DNS prefetch hint for the emoji CDN, so the browser stops opening a connection it will never use

Good to know

  • Emoji you type into posts, titles, and menus render exactly as they did before
  • Each hook is removed at the priority core actually registered it on, rather than assuming the default. Core does not use the same priority for all of them, which is why the copy and paste version of this snippet silently leaves some of it in place.
  • Nothing to configure. Activate it and it is done.

More php snippets