[wp-trac] [WordPress Trac] #43145: Theme and Plugin Editor unable to edit PHP files for Active theme/plugin of Main Site in a Multisite system (was: Theme Editor unable to edit PHP files for Active theme of Main Site in a Multisite system)

WordPress Trac noreply at wordpress.org
Sun Mar 25 15:11:29 UTC 2018


#43145: Theme and Plugin Editor unable to edit PHP files for Active theme/plugin of
Main Site in a Multisite system
----------------------------------+----------------------------------------
 Reporter:  Otto42                |       Owner:
     Type:  defect (bug)          |      Status:  new
 Priority:  normal                |   Milestone:  Awaiting Review
Component:  General               |     Version:  4.9.2
 Severity:  normal                |  Resolution:
 Keywords:  has-patch needs-      |     Focuses:  administration, multisite
  testing                         |
----------------------------------+----------------------------------------
Changes (by andrea.r):

 * keywords:   => has-patch needs-testing


Comment:

 Hello,
 Same issue here on WP 4.9.4, and it also applies to the Plugin Editor when
 trying to edit plugins active on the main site.

 I tracked down the issue to the fact that the URL called by the loopback
 test to verify that no errors were introduced in the PHP theme/plugin code
 is referring to the non-multisite theme/plugin editor (see lines 525..537
 of {{{wp-admin/includes/file.php}}}), which triggers a redirect to the
 multisite editor without passing along the query string (line 13 of {{{wp-
 admin/plugin-editor.php}}} and {{{wp-admin/theme-editor.php}}}) which
 contains the scrape_key and transient needed to correctly handle the
 request (see functions {{{wp_start_scraping_edited_file_errors}}} and
 {{{wp_finalize_scraping_edited_file_errors}}} in {{{wp-
 includes/load.php}}}).

 I suggest changing the references to {{{admin_url}}} in lines 525..537 of
 file {{{wp-admin/includes/file.php}}} into {{{network_admin_url}}}, which
 falls back to {{{admin_url}}} if the installation is not multisite.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43145#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list