Opened 9 years ago
Closed 9 years ago
#38455 closed defect (bug) (duplicate)
Customizer: new theme browser in multisite is missing updates.js
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.7 |
| Component: | Customize | Keywords: | |
| Focuses: | javascript, multisite | Cc: |
Description
Running latest 4.7 trunk on my local machine, no plugins active, I'm testing the new theme browsing experience (see #37661) in a Multisite installation and I found this bug.
When as a superadmin, both on the main site as on another subsite, trying to install or install/preview a theme, the console logs the following error, without the user receiving any visual feedback in the theme browser:
Uncaught TypeError: Cannot read property 'maybeRequestFilesystemCredentials' of undefined
This is located in the installTheme function in wp-admin/js/customize-controls.js at line 2155. Tracing the undefined state of wp.updates back, brings us to the enqueue_control_scripts() method of the WP_Customize_Manager class. Here the updates script is only enqueued when ! is_multisite(). For whatever historical reason, this prevents theme installing on Multisite installs. I am not aware of the origin behind this, but removing that conditional fixes the issue.
After the fix
When this would be fixed, installing themes in a multisite subsite context, generates a situation where the installed theme would not yet be available for that subsite (try install/preview). This results in a The requested theme does not exist. error of the wp_die() kind. This follows the logic of themes having to be network activated or assigned to the specific subsite. Please consider a nice way to deal with this situation or at least generate a more user-friendly error which keeps the user in the Customizer.
Hello @Offereins,
thanks for the report, we're already tracking this issue in #38370. Can you give the patch a try and report there if it fixes the issue for you? Thanks!