WordPress.org

Make WordPress Core

Opened 12 days ago

#44514 new defect (bug)

Can’t edit main theme php files after upgrading to 4.9

Reported by: aguidrevitch Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.6
Component: Themes Keywords: needs-patch
Focuses: Cc:

Description

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 is https://wordpress.org/support/topic/cant-edit-main-theme-php-files-after-upgrading-to-4-9/

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

Change History (0)

Note: See TracTickets for help on using tickets.