If you’ve been texting and chatting a lot on the web these days, you couldn’t have failed to notice the colorful little icons that your friends have been using to represent all kinds of objects. Whether it be simple extensions of emoticons, or representations of real-world objects like doughnuts, keys, or balloons, there’s no doubt that they can enliven a conversation and make it more expressive. These are called “Emojis”. They have come to be written in the Unicode standard and are becoming more and more prevalent. Lately, some smartphone keyboards have started suggesting emoji replacements for commonly entered text words.
In version 4.2, WordPress introduced support for emojis which means that users can now place these characters directly into their posts without any prior preparation or plug-ins. Moreover, they can be used anywhere on the WordPress site – not just within the post itself. In this article, we take a look at how to use emojis within WordPress as well as how to disable support in case you don’t want the additional script overhead.
Using Emojis in WordPress
There are many ways to include emojis in WordPress. The simplest way would be to simply copy the symbol in Unicode and paste it wherever you want. There are many sites which give a comprehensive list of available emojis, but I personally use this one: http://www.iemoji.com/. It has a search function that allows you to quickly locate the emoji you want and gives you the various representations.
For example, let’s say I’m writing a post about why I love coffee and I want to replace the word “coffee” with an emoji. I visit the site above and search for “hot beverage” as shown below:
Once you select the symbol, it will place the relevant emoji into the text box above as indicated with the red arrow. This is not a picture but a textbased character, which means you can select, copy and paste it. So while opening up my WordPress post for editing, I place it right into the title like this:
As you can see, it renders in the text field exactly as shown earlier. However, this won’t be the final form that it takes. As you can see below after publishing the post, this Unicode character is rendered as an image by WordPress:
Also note that the title of the tab itself displays the textbased version of the emoji. You can see that support for this type of character is integrated throughout all modern software components – the browser, HTML, as well as all social media platforms. Though there are some operating systems and software stacks that still don’t display emojis properly, that list is growing shorter all the time, especially in the days of automatic software updates.
Disabling Emoji Support
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' );
Place this into the end of your functions.php file and save it. With this code, WordPress no longer translates emoji Unicode characters into their pictorial equivalents and simply displays them “as is” as shown here:
In case you’re wondering how WordPress stores emojis internally, this will depend upon the version of the MySQL database in use. With version 5.5 and above, MySQL is able to store 4 byte Unicode characters natively. So for my above post, WordPress stores the title like this:
Emojis are here to stay and are only set to become even more popular as time goes by. Though their use has yet to stabilize in various communication platforms, there’s no harm in keeping it enabled in WordPress as long as page load times are not affected.