If you receive the error message "Update failed" or "Publish failed" when saving or publishing a post in the WordPress Gutenberg editor and your text contains special characters such as emoticons, this could be due to an incorrect database configuration 🙀!
In this article, I will show you step by step how to fix the problem.
Cause of the problem: Is the character set correct?
The character set utf8mb3
(or also utf8
) only supports characters with up to three bytes. However, emojis and many special characters require four bytes. If your WordPress database is still on utf8mb3
is set, saving an emoticon will result in an error message.
Solution: Conversion of the database to utf8mb4
Step 1: Backup!!!!
As always, before operating on database structures, create a complete backup of your database. We assume that you have access to the "PHPMyAdmin" tool.
- Log in to phpMyAdmin.
- Select the affected database.
- Click above on "Export".
- Select the "Quick" option and click on "OK"to download the SQL file.
Step 2: Check the character set of the database
- Open phpMyAdmin and select your WordPress database.
- Go to the tab "Operations".
- Check under "Collation"whether the character set
utf8mb3_general_ci
or another obsolete character set is used.
Step 3: Change character set
Change database character set
- In the tab "Operations" the new character set
utf8mb4_unicode_ci
from. - Activate the option "Change collation for all tables" and click on "OK".
If not all tables or columns have been automatically adapted to the new character set
- Go back to the overview of your tables.
- Click on a table (e.g.
wp_posts
) and open the tab "Operations". - Change the character set to
utf8mb4_unicode_ci
. - Repeat this step for all relevant tables (e.g.
wp_comments
,wp_options
).
Sometimes individual columns need to be adjusted:
- Open the table and go to the tab "Structure".
- Edit columns with text content (e.g.
post_content
,post_title
) and change their collation toutf8mb4_unicode_ci
.
Step 4: Customise the WordPress configuration
Make sure that your file wp-config.php
specifies the correct character set:
- Open the file
wp-config.php
in the root directory of your WordPress installation. - Search for or complete the following lines:
define(DB_CHARSET', 'utf8mb4');
define(DB_COLLATE', 'utf8mb4_unicode_ci');
Code language: JavaScript (javascript)
- Save and upload the file again.
5. reminder: clear cache / reload editor
Clear the cache of your website (if available) and the browser cache to ensure that the changes take effect.
If your Gutenberg editor is still open, reload the article using the "Refresh" function of your web browser
Check whether the problem has been resolved
Now try again to save or publish a post with emojis or special characters:
- Open the Gutenberg editor and insert an emoji into a paragraph.
- Save or publish the post.
If everything has been done correctly, the problem should be solved.
Conclusion
The error message "Update failed" in the Gutenberg editor can be caused by an outdated database configuration, in particular by the character set utf8mb3
. With the switch to utf8mb4
not only ensure that emojis are supported, but also make your website future-proof.
🤖
And if all this is too much effort for you, then simply call a website gardener 👩🌾