1

Just updated my local and live installs for a side project to 4.2 in order to take advantage of the newly added Emoji features. Emoji are working just fine on my local machine, but they seem to not be working as comments on the live version.

Local

  • emoji in post title - working
  • emoji in post content - working
  • emoji in comments - working

Live

  • emoji in post title - working
  • emoji in post content - working
  • emoji in comments - not working

Troubleshooting

  • Theme - Tried activating Twenty Fifteen; didn't work.
  • Plugins - Tried deactivating all plugins; didn't work.
  • Theme + Plugins - Tried activating Twenty Fifteen and deactivating all plugins; didn't work.
  • Normal comments - Regular characters save and display as comments just fine.
  • Emoji - they display in the 'comment field' when adding a comment, but once submitted, the seem to be stripped out. In wp-admin an emoji comment just seems to be blank with no text at all.

I have tried all of the basic troubleshooting I can think of, are there any other things I am not thinking of?

0

It seems you need to change the Collation for the wp_comments and wp_commentmeta tables on your Live server to utf8mb4_unicode_ci.

  • Changing the collation of the table doesn't affect existing columns; they need to be manually changed as well. – Synetech Oct 8 '18 at 4:46
0

I have just solved this!

The emoji needs to be converted to UTF8 encoded string while storing in MySQL database and of course your database column collation must be utf8mb4: <?php utf8_encode($comment); ?> Then while displaying do the reverse: <?php utf8_decode($comment); ?> I'm sorry I don't have code for WordPress as I use it only as a CMS to store the data and use another PHP MVC framework to fetch it for API.

Hope this helps.

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.