This error often occurs to webmasters when updating or publishing posts in WordPress. There are several ways to report this error:
- Update failed. Response is not a valid json response.
- Publish error: Response is not a valid json response
- Updating failed. The response is not a valid JSON response.
There are several solutions to this problem.
Disabling the block editor Gutenberg
After updating WordPress to version 5.0, everyone had the Gutenberg editor enabled by default, which brought quite a few problems and questions. Therefore, I disable Gutenberg on all WordPress sites. To disable it, you can use
- Paid Clearfy Plugin - will solve the problem with the error when publishing, and also eliminate many other regular WordPress problems
- Free plugin Classic Editor
After installation and activation the Gutenberg editor will stop working and posts can be published again
Other options for solving the problem
If after disconnection Gutenberg publishing error did not disappear, here are alternative solutions
Way | Description |
---|---|
Updating permanent links | 1. Go to the site console -> Settings -> Permanent links. 2. Click the Update button. 3. Check the changes. |
No SSL certificate | It is recommended to use free SSL certificates Let's Encrypt. |
Resolving mixed content error | 1. Check in the settings that the URLs start with https. 2. Install and activate the Really Simple SSL plugin. 3. In Settings -> SSL, activate the options Mixed content fixer, Enable WordPress 301 Redirection to SSL, Enable 301 .htaccess redirect. 4. Check the changes. |
Checking Rest API and wp-json activation
Disabling the REST API is a common cause of errors when updating pages and posts.
To check, go to the theme editor and open the functions.php file. Review the code carefully. If the REST API and wp-json have been disabled, you will find the following lines of code:
// Deactivate REST API add_filter('rest_enabled', '__return_false'); // Removing filters REST API remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd'); remove_action( 'wp_head', 'rest_output_link_wp_head', 10, 0); remove_action( 'template_redirect', 'rest_output_link_header', 11, 0); remove_action( 'auth_cookie_malformed', 'rest_cookie_collect_status'); remove_action( 'auth_cookie_expired', 'rest_cookie_collect_status'); remove_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status'); remove_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status'); remove_action( 'auth_cookie_valid', 'rest_cookie_collect_status'); remove_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100); // Cancel REST API events remove_action( 'init', 'rest_api_init'); remove_action( 'rest_api_init', 'rest_api_default_filters', 10, 1); remove_action( 'parse_request', 'rest_api_loaded'); // Disable Embeds associated with REST API remove_action( 'rest_api_init', 'wp_oembed_register_route'); remove_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4); remove_action( 'wp_head', 'wp_oembed_add_discovery_links'); remove_action( 'wp_head', 'wp_oembed_add_host_js');
If you find such code, you should delete it. Then go to the "Settings" section, select "Permanent links" and click "Update".