Support » Networking WordPress » Can’t edit main theme php files after upgrading to 4.9

  • I am unable to edit main theme (php) files using the build in WordPress editor after upgrading to version 4.9. I get the following 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.

    The original topic, https://wordpress.org/support/topic/cant-edit-main-theme-php-files-after-upgrading-to-4-9/ is already closed, so let me start a new one. I’m getting the same problem, and the reason for it is multisite setup. Here is what happens, when I try to save a php template:

    wp_edit_theme_plugin_file() (wp-admin/includes/file.php) tries to fetch /wp-admin/theme-editor.php?theme=themename&file=template-name.php&wp_scrape_key=bc5c7a4ffcba576858c8628c403fff56&wp_scrape_nonce=340388534

    And while the response contains ###### wp_scraping_result_start… #####, the response itself is a 302 redirect to /wp-admin/network/theme-editor.php because of multisite setup, so this wp_scraping_result_start is ignored. Then, /wp-admin/network/theme-editor.php does not produce

    I can only guess that wp_edit_theme_plugin_file() should use network_admin_url() instead of admin_url() for multisite configurations, when forming loopback request URL in wp_edit_theme_plugin_file().

    Please let me know if my explanation is clear, and happy fixing )

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.