[wp-trac] [WordPress Trac] #45755: Theme Editor WSOD functionality doesn't work with Multisite

WordPress Trac noreply at wordpress.org
Mon Dec 24 09:07:45 UTC 2018


#45755: Theme Editor WSOD functionality doesn't work with Multisite
--------------------------------+-----------------------------
 Reporter:  dd32                |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  4.9
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 The WSOD prevention code for the Theme & Plugin Editors don't work
 correctly for Multisite installations, which causes the entire feature to
 fail to update files.

 The problem is caused by `wp_edit_theme_plugin_file()` which uses `/wp-
 admin/admin-ajax.php` on multisite (we don't have a network admin ajax
 handler) and subsequently calls `admin_url( 'theme-editor.php' );` which
 will ultimately be a URL which redirects to `wp-admin/network/theme-
 editor.php` and thus fail the checks placed upon the response
 (`loopback_request_failed`).

 Instead of using `admin_url( 'theme-editor.php' )` it can be done like so:
 {{{
 // Theme Editor on Multisite is always network-wide
 is_multisite() ? network_admin_url( 'theme-editor.php' ) : admin_url(
 'theme-editor.php' )
 }}}
 Unfortunately as `admin-ajax.php` has no context of whether it's being
 called from a Network Admin, `self_admin_url()` isn't a viable option
 here.

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


More information about the wp-trac mailing list