Some plugins will make WP theme editor unresponsive
When saving a theme file (say header.php) in unmanaged or managed WP app, you might see the theme editor or some other functions like file upload go completely unresponsive (like the screenshot below) or show an 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..
tl;dr - The issue is with some of the WP plugin(s) you have installed which are still using legacy PHP sessions. Try disabling some plugins and editing the file again.
PHP sessions are created using
session_start. This method creates files on the filesystem and also gets a lock! When using sessions, all other PHP scripts will block until the current script has completed (yes, really). WP itself does not use PHP sessions but many plugins do. In WP 4.9, they added a fix to the theme editor to check if the code is valid. They do this saving the file and doing a loopback request to see if the file is OK. If the loopback call fails, they revert the editor changes. It's sensible except that when if you have plugin which is using PHP sessions, this loopback request will fail because only one PHP script can run at a time!
Identifying the plugins
Open a Web terminal and go to the plugins directory of wordpress and do a
grep -ir session_start. That will give you the plugins which will cause this problem.
Note that as mentioned earlier, not only do those plugins cause the theme editor to fail but they will also severely affect the parallelism of your site because of the session lock!
The fix is to just not use those plugins + inform the developer about it.
- https://wordpress.org/support/topic/the-loopback-request-to-your-site-failed-4/page/2/#post-10662220 (fix for plugin authors)
Writing this post was cathartic, since I was going crazy trying to figure why