{"id":13289,"date":"2022-06-26T10:08:48","date_gmt":"2022-06-26T07:08:48","guid":{"rendered":"https:\/\/kifarunix.com\/?p=13289"},"modified":"2024-03-09T15:05:56","modified_gmt":"2024-03-09T12:05:56","slug":"wordpress-fix-updating-failed-the-response-is-not-a-valid-json-response","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/wordpress-fix-updating-failed-the-response-is-not-a-valid-json-response\/","title":{"rendered":"WordPress: Fix Updating failed. The response is not a valid JSON response"},"content":{"rendered":"\n<p>In this tutorial, I will show you a quick fix to the common WordPress error, Updating failed. The response is not a valid JSON response related to default Gutenberg editor.<\/p>\n\n\n\n<p>Note that I experienced this issue while adding a specific block of text on WordPress post. Whenever i tried to save the post after adding that block, it always resulted in the annoying message;<\/p>\n\n\n\n<p><em><strong>Updating failed. The response is not a valid JSON response<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1474\" height=\"577\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed.-The-response-is-not-a-valid-JSON-response.png\" alt=\"Fix Updating failed. The response is not a valid JSON response\" class=\"wp-image-13291\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed.-The-response-is-not-a-valid-JSON-response.png?v=1656222597 1474w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed.-The-response-is-not-a-valid-JSON-response-768x301.png?v=1656222597 768w\" sizes=\"(max-width: 1474px) 100vw, 1474px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Fix Updating failed. The response is not a valid JSON response<\/h2>\n\n\n\n<p>If you paste this specific keyword on the Google search bar, you will get millions of results on how to fix this issue.<\/p>\n\n\n\n<p>I tried to implement most of the solutions such as;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Updating the WordPress permalinks<\/li>\n\n\n\n<li>Using the Classic editor instead. <em>This couldn&#8217;t my choice even if it could solve the issue since it really sucks, imho!<\/em><\/li>\n\n\n\n<li>I dont know, fix SSL redirect issues&#8230;<\/li>\n\n\n\n<li>Regenerate WordPress .htaccess file<\/li>\n\n\n\n<li>Check the themes and plugins<\/li>\n\n\n\n<li>Check site health<\/li>\n\n\n\n<li>and the endless Internet suggestions&#8230;<\/li>\n<\/ul>\n\n\n\n<p>I ransack the site configurations up and down but I never found out any issue on my backend server\/WordPress configs.<\/p>\n\n\n\n<p>So, I am using Cloudflare!<\/p>\n\n\n\n<p>It turns out that a specific Cloudflare special managed rules were blocking some requests generated whenever I hit <strong>Save<\/strong> button after adding that specific block on WordPress post.<\/p>\n\n\n\n<p>How did I find out about Cloudflare blocking this request?<\/p>\n\n\n\n<p>Well, on the WordPress post page;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>open the browser developer tools using <strong>Ctrl+Shift+I<\/strong>. It should work on both Chrome and Firefox.<\/li>\n\n\n\n<li>Head over to the Network tab;<\/li>\n<\/ul>\n\n\n\n<p>As you can see from my screenshot below, some requests with specific query is returning Forbidden Error 403 code.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json-network-inspect-tools.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1889\" height=\"803\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json-network-inspect-tools.png\" alt=\"Fix Updating failed. The response is not a valid JSON response\" class=\"wp-image-13292\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json-network-inspect-tools.png?v=1656223615 1889w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json-network-inspect-tools-768x326.png?v=1656223615 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json-network-inspect-tools-1536x653.png?v=1656223615 1536w\" sizes=\"(max-width: 1889px) 100vw, 1889px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>Drilling down further by clicking that specific line with 403 status to the headers;<\/p>\n\n\n\n<p>Request Headers tab, <strong><code>path: \/wp-json\/wp\/v2\/posts\/13239<\/code><\/strong> and Query String: <strong><code>?_locale=user<\/code><\/strong><\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json_request-headers.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1901\" height=\"591\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json_request-headers.png\" alt=\"Fix Updating failed. The response is not a valid JSON response\" class=\"wp-image-13294\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json_request-headers.png?v=1656224017 1901w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json_request-headers-768x239.png?v=1656224017 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/wordpress-update-invalid-json_request-headers-1536x478.png?v=1656224017 1536w\" sizes=\"(max-width: 1901px) 100vw, 1901px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>On the <strong>Preview tab<\/strong>, there was this message;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>Please enable cookies.\n\n<strong>Sorry, you have been blocked<\/strong>\n<strong>\nYou are unable to access kifarunix.com<\/strong>\n<strong>\nWhy have I been blocked?<\/strong>\n\nThis website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.\n\n<strong>What can I do to resolve this?\n<\/strong>\nYou can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.\n\nCloudflare Ray ID: 7213e53f69xxxxxx \u2022 Your IP: xx.xx.xx.xx \u2022 Performance &amp; security by Cloudflare\n<\/code><\/pre>\n\n\n\n<p>On the <strong>Response tab<\/strong>, I could see some cookies are blocked!<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>&lt;script&gt;\n  if (!navigator.cookieEnabled) {\n    window.addEventListener('DOMContentLoaded', function () {\n      var cookieEl = document.getElementById('cookie-alert');\n      cookieEl.style.display = 'block';\n    })\n  }\n&lt;\/script&gt;\n<\/code><\/pre>\n\n\n\n<p>So, I contacted Cloudflare support who pointed me to update my firewall rules and allow the request accordingly using the Ray ID given on the preview tab.<\/p>\n\n\n\n<p>So head over to Cloudflare web interface and filter for the Security &gt; Overview and filter the events related to the specific Ray ID given, source IP or even the paths on the request headers.<\/p>\n\n\n\n<p>Sample screenshot.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed-Cloudflare.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1367\" height=\"2318\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed-Cloudflare.png\" alt=\"Fix Updating failed. The response is not a valid JSON response.\" class=\"wp-image-13297\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed-Cloudflare.png?v=1656225469 1367w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed-Cloudflare-768x1302.png?v=1656225469 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed-Cloudflare-906x1536.png?v=1656225469 906w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/Fix-Updating-failed-Cloudflare-1208x2048.png?v=1656225469 1208w\" sizes=\"(max-width: 1367px) 100vw, 1367px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>As you can see, the block contained some specific keywords or whatever it is that are seen by Cloudflare firewall rules as malicious and is thus blocked by the default managed rules.<\/p>\n\n\n\n<p>So, in order for me to proceed to save my posts, I had to write a rule that checks for my source IP and the specific keywords on the request path and set the firewall to bypass the managed rules.<\/p>\n\n\n\n<p><strong>The specific managed rule number 100005 is under the Cloudflare Specials rules group.<\/strong><\/p>\n\n\n\n<p>Thus, this is the rule to bypass this at least from my source IP.<\/p>\n\n\n\n<p>Security &gt; WAF &gt; Firewall Rules<\/p>\n\n\n\n<p>My sample rules;<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-bybpass-wordpress-invalidjson-update-firewall-rules.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1448\" height=\"1674\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-bybpass-wordpress-invalidjson-update-firewall-rules.png\" alt=\"Fix Updating failed. The response is not a valid JSON response.\" class=\"wp-image-13298\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-bybpass-wordpress-invalidjson-update-firewall-rules.png?v=1656226311 1448w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-bybpass-wordpress-invalidjson-update-firewall-rules-768x888.png?v=1656226311 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-bybpass-wordpress-invalidjson-update-firewall-rules-1329x1536.png?v=1656226311 1329w\" sizes=\"(max-width: 1448px) 100vw, 1448px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>Save and it should be enabled.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-firewall-rules.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1746\" height=\"800\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-firewall-rules.png\" alt=\"Fix Updating failed. The response is not a valid JSON response.\" class=\"wp-image-13299\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-firewall-rules.png?v=1656226381 1746w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-firewall-rules-768x352.png?v=1656226381 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/06\/cloudflare-firewall-rules-1536x704.png?v=1656226381 1536w\" sizes=\"(max-width: 1746px) 100vw, 1746px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>You now be able to save your post with no error, <strong>Fix Updating failed. The response is not a valid JSON response.<\/strong><\/p>\n\n\n\n<p>If you are using Cloudflare, then that is it on how to fix WordPress Fix Updating failed. The response is not a valid JSON response error.<\/p>\n\n\n\n<p>That marks the end of our tutorial on how to fix WordPress Fix Updating failed. The response is not a valid JSON response.<\/p>\n\n\n\n<p>Other Tutotials;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/protect-wordpress-against-brute-force-attacks-using-fail2ban\/\" target=\"_blank\" rel=\"noreferrer noopener\">Protect WordPress Against Brute force Attacks Using Fail2ban<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/restrict-access-to-wordpress-login-page-to-specific-ips-with-libmodsecurity\/\" target=\"_blank\" rel=\"noreferrer noopener\">Restrict Access to WordPress Login Page to Specific IPs with libModSecurity<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I will show you a quick fix to the common WordPress error, Updating failed. The response is not a valid JSON response<\/p>\n","protected":false},"author":1,"featured_media":13301,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,34],"tags":[5448,5445,5458,5449,5447,5446],"class_list":["post-13289","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-security","tag-cloudflare-updating-failed-the-response-is-not-a-valid-json-response","tag-fix-updating-failed-the-response-is-not-a-valid-json-response","tag-updating-failed-the-response-is-not-a-valid-json-response","tag-wordpress-cloudflare-updating-failed-the-response-is-not-a-valid-json-response","tag-wordpress-fix-updating-failed","tag-wordpress-gutenberg-fix-updating-failed-the-response-is-not-a-valid-json-response","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/13289"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=13289"}],"version-history":[{"count":10,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/13289\/revisions"}],"predecessor-version":[{"id":20557,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/13289\/revisions\/20557"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/13301"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=13289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=13289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=13289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}