I’ve run into an issue with updating the header.php file in a WordPress website.
Firstly, I tried updating the file manually through C-Panel -> File Manager. The code appears to stay in the file, but when you view the page source in incognito mode and different web browsers the code doesn’t render.
It’s not a server problem, I already contacted the server support team and there aren’t any error logs being reported by MySQL.
There doesn’t appear to be many solutions for this from what I can find from doing some searches on Google.
Full Error
Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.
Is it Cpanel that throwing you this error? If so, it may be that Cpanel checks for PHP error after your changes, and revert back if any error is detected. I recommend using a local environment to update and test files, instead of using Cpanel file manager/FTP. Can you check PHP logs?
Mtxz this error is showing up in the WordPress dashboard in the editor where you edit the theme files directly.
– nickhiebertdevOct 5, 2018 at 18:39
What worked for me is disable all plugins and then re-enable them. This was caused by a wordpress update. Everything is working as expected now, but it was quite frustrating..
PS: Use the bulk deactivate action.
The error is ultimately caused by either a “poorly coded” theme or plugin, at least from the viewpoint of WordPress Core. While a variety of things might temporarily fix the issue, the error might end up coming back unless the author of the extension updates their code (or you deactivate/delete the plugin in question). Another option might be disabling the WordPress PHP code validation feature with custom functions installed as a MU plugin (at least theoretically) …
– Jesse NicklesAug 31, 2020 at 21:42
This error comes from a WordPress feature included in WordPress 4.9. It basicaly check for PHP errors upon file uploading in the WP file editor to prevent saving code that could/will break your site.
It’s mostly a plugin (or a server configuration) that prevent the WordPress loopback check to properly check for potential errors caused by your update. As WordPress is not able to check whether your new code will produce errors or not, it prevents the code update.
Check those links:
- https://wpengine.com/support/php-editor-errors-wordpress-4-9-higher/
- https://wordpress.org/support/topic/cant-edit-main-theme-php-files-after-upgrading-to-4-9/
You could try disabling your plugins to see if the feature make it back, or update your files using FTP/SFTP (without the WordPress file editor).
Mtxz, thanks for providing that. I’m holding off on this until Tuesday to take this. I’ll likely backup the whole website and investigate this further.
– nickhiebertdevOct 5, 2018 at 19:33
I’m a little late to the party, and Mtxz is right on their answer. However, their solution doesn’t “fix” the issue. I found this forum which says you can solve it by removing lines 492 – 599 in the wp-admin/includes/file.php file.
The first line is if ( $is_active && 'php' === $extension ) {
and the third last line is return new WP_Error( 'php_error', $message, $result );
, followed by two lines of brackets.
This fixed the issue on several of my servers.
Note: this solution also removes PHP debugging, so if you have a syntax error and you do this, your site might crash and you can’t edit the files unless you go through SFTP/FTP. As always, it’s best to have a backup before editing files.
This is some great insight. I’ll circle back to this if it comes up in the future. Cheers!
– nickhiebertdevJan 11, 2020 at 17:06
- 1Actulaly it is better to not remove that code.Error is coming from file wp-admin/includes/file.php It exits 2 tests, 1 with :
$r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
and the other only:$r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) );
Just add, 'sslverify'
in the second after time out and you should be able to push your files 🙂 – MaxiGui Jun 27, 2020 at 7:20
In my case, I used a wordpress installation behind cloudflare. My website protocole was HTTPS as I used the cloudflare certificate. However, on the server side, it was a self-signed certificate.
I have installed a let’s encrypt certificate in place of the self-signed certificate and then it worked. Afterwards, I could save PHP files in the wordpress file editor.
After installing a wordpress plugin named health check, I saw that the error was “curl self signed certficate”.
Now, this technically didn’t fix the issue at hand. But I just added a WordPress plugin called Insert Headers and Footers and I added the header script and it worked successfully.
Cloudflare was my issue as well. I had a firewall rule limiting access to wp-admin and that was preventing me from saving file edits. I had to add a firewall rule to allow my particular IP address.
Super late to the party, but if this helps someone.. This fixed my issue
Edit line from /wp-admin/includes/file.php
if ( $is_active && 'php' === $extension ) {
to
if ( $is_active && 'php' === $extension && false) {
I had a similar issue, my wordpress version is 5.2.2.
“Database Browser” plugin, which is untested with my version of WordPress created the issue. It was fixed by deactivating that plugin.
So check the plugins which are “Untested with your version of WordPress” ( this can be seen while installing a plugin from dashboard-> plugins-> Add new ), deactivate them (if unnecessary ) and try using “theme editor” for updating file.
I agree with @nickdevyyc that, there is no technical solution for this. But It’s better that we can use some external plugin which provide File Manager and where we can edit every file. Here one I found
This work with me like a charm and save my day!
If you are using Cloudflare, try Cloudflare’s “Development mode” button. (This is what cured it for me). Other answers have mentioned issues with Cloudflare but development mode is easy to check if it cures the problem, easy to implement whenever you want to edit, and safe because it disables itself if you forget to turn it off.
Mine was a plugin and the problem was because I was editing a plugin that was active. Just deactivate the plugin and try again.
source : https://stackoverflow.com/questions/52671255/wordpress-editor-not-updating-files-unable-to-communicate-back-with-site-to-che