Opened 4 years ago
Last modified 2 years ago
#39451 new defect (bug)
Javascript error when link_manager_enabled ( WP_Widget_Links) and theme supports customize-selective-refresh-widgets
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.5 |
Component: | Customize | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description
The error occurs in the customizer when a user uses the WP_Widget_Links
widget has enabled support for customize-selective-refresh-widgets
.
The WP_Widget_Links
is now deprecated, but it is retro-compatible if user had it already installed.
The error message in the browser js console looks like this :
customize-preview-widgets.js?ver=4.7:63 Uncaught Error: Illegal id for widget partial. at child.initialize (customize-preview-widgets.js?ver=4.7:63) at child.api.Class (customize-base.js?ver=4.7:93) at child [as constructor] (customize-base.js?ver=4.7:34) at new child (customize-base.js?ver=4.7:34) at HTMLDivElement.<anonymous> (customize-selective-refresh.js?ver=4.7:863) at Function.each (jquery.js?ver=1.12.4:2) at jQuery.fn.init.each (jquery.js?ver=1.12.4:2) at Object.wp.customize.selectiveRefresh.self.addPartials (customize-selective-refresh.js?ver=4.7:850) at Function.<anonymous> (customize-selective-refresh.js?ver=4.7:961) at i (jquery.js?ver=1.12.4:2)
Theme or plugin developers can fix the problem by removing the support for customize-selective-refresh-widgets
if link_manager_enabled
is set to true. But a core fix would be better of course.
Temporary solution :
if ( ! get_option( 'link_manager_enabled' ) ) { add_theme_support( 'customize-selective-refresh-widgets' ); }
Attachments (1)
Change History (10)
#2
@
4 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
Coincidentally I also ran across this issue myself in working on the JS Widgets plugin for #33507 and #35574.
#4
@
4 years ago
OK.
The bug was reported by two different users for my theme Hueman.
The latest topic is this one : https://wordpress.org/support/topic/customizer-never-loads-in-chrome-with-hueman-addon-plugin-enables/
cheers
#5
@
3 years ago
I've run into this problem too with users. I've also seen it within a plugin of mine that creates a more robust links widget.
I think this is because the links widget creates "fake" widgets on output. Each category of links is wrapped into its own widget markup. And, the customizer JS is looking to match actual widgets.
Even disabling the customize_selective_refresh
for the Links widget doesn't address the issue.
This ticket was mentioned in Slack in #core-customize by presskopp. View the logs.
3 years ago
#7
@
3 years ago
- Keywords has-patch added; needs-patch removed
WP_Widget_Links::widget()
contains a preg_replace()
for the id
attribute that also seems to be affecting the data-customize-partial-id
attribute, creating the "illegal id." The fix might be as straightforward as adjusting the regex pattern, which I've tried in 39451.diff.
There's a typo in my description. I meant : The error occurs in the customizer when a user uses the
WP_Widget_Links
widget and has enabled support forcustomize-selective-refresh-widgets
.