[wp-trac] [WordPress Trac] #44514: Can’t edit main theme php files after upgrading to 4.9

WordPress Trac noreply at wordpress.org
Wed Jul 4 18:43:36 UTC 2018


#44514: Can’t edit main theme php files after upgrading to 4.9
--------------------------+-----------------------------
 Reporter:  aguidrevitch  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:  4.9.6
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44514>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list