Emoji deleted from ACF field after saving
So you have a ACF text field and you are trying to insert emoji to it. For example as a category icon. You add the field, add the emoji, use the PHP code to display the field. And emoji is missing.
After that you found that every time you save the page, emoji dissapear from the field. Why? Because you have wrong database character set. Go to your wp-config.php file on ftp and search for:
/** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' );
If there is DB_CHARSET set to utf8, you found the problem. You need to set your database to utf8mb4_unicode_ci.
Hot to do that?
I am not responsible for your crashed sites etc.. Please do a backup before!!
Change this line in wp-config.php to
/** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8mb4' );
Then go to your WordPress database via phpMyAdmin and select your database. You can see your collation in column.
Go to the edits and set Collations to utf8mb4_unicode_ci and change in all tables and table columns. Click on apply-
You are done 🙂 your emoji will stay in fields now.