Fixed : Publish Failed on WordPress 5.2

wordpress publish failed

After switching hosting, I encountered an obstacle that could not publish the article. I am using VPS with the nginx server, PHP 7.2 and running on the Ubuntu operating system 16.04. Not forgetting to mention, I used wordpress 5.2 (most updated when this article was written)

The problem is, I can’t publish posts, I can’t update posts and everything feels wrong.

I already know the problem is in the latest wordpress editor Guttenberg. This editor will communicate with the web browser client to exchange data.

Actually, I can replace the latest editor with a legacy editor called the classic editor, a plugin. But I like the guttenberg editor. Sophisticated and simple.

So, I tried to fix the problem. The key word is blocked-missing, which is a web browser blocking data sent by the server through the ajax mechanism because SSL is invalid.

I am reminded that VPS uses cloudflare as DNS. I activate SSL on cloudflare while wordpress that has just been installed has not enabled the SSL site.

The solution is: enable SSL on wordpress by adding the following code to the wp-config.php file

define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain 
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

Save and done. WordPress 5.2 publish failed is fixed now

Also, you can try this solution https://www.saotn.org/always-populate-raw-post-data-magento-20/

Leave a Reply

Your email address will not be published. Required fields are marked *