Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Some plugins will make WP theme editor unresponsive

    WordPress (Managed)
    1
    1
    55
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • girish
      girish Staff last edited by

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

      8ffb8498-4b98-475d-8e4a-7d53ca15846e-image.png

      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.

      Long version

      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!

      It looks me a while to figure the about out but this comment by a WP dev and this bug report helped me connect various bits of info together.

      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!

      Fix

      The fix is to just not use those plugins + inform the developer about it.

      Some references:

      • https://wordpress.org/support/topic/cant-edit-main-theme-php-files-after-upgrading-to-4-9/page/5/#post-9703465
      • 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 session_start was hanging 🙂

      1 Reply Last reply Reply Quote 3
      • First post
        Last post
      Powered by NodeBB