问题
Hello fellow developers and problem-solvers. 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.
Any help at all would be greatly appreciated.
回答1:
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.
回答2:
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.
回答3:
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).
回答4:
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.
回答5:
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.
来源:https://stackoverflow.com/questions/52671255/wordpress-editor-not-updating-files-unable-to-communicate-back-with-site-to-che