For sites running PHP 5.6, sometimes you can run into errors like “Publishing failed” where a post won’t publish or update while using the Block Editor.

Errors like these can be caused by PHP errors, or notices appearing in the content before the expected response. This is not a bug in our code or something we can resolve. It is a side effect of running outdated PHP.

One common notice is a Deprecated notice with the following text:

PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

The WordPress Block editor uses a special request type in the REST API which can trigger this on servers that run PHP 5.6. The deprecation notice is triggered by PHP and cannot be avoided.

Check out this great post explaining the cause of this problem in depth

A quick solution to this is to set the following value in your php.ini file:

always_populate_raw_post_data = -1

The good news is that PHP 7.0+ no longer requires or uses this config value, the capability to receive various request types is now baked into PHP itself. We recommend you upgrade from PHP 5.6 soon as it will no longer be supported.  See the official WordPress version recommendations.

Check out How To Easily Check And Update The PHP Version Of Your WordPress Site.  If you’re ready to upgrade the version of PHP on your site, please be sure to back up and test on a staging site.

Are you still having issues after adding the code? Visit our Help Desk and let us take a look.