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.
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.
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:
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).
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.
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.