I have created several custom widgets, modeled from the default widgets' code. The widgets all work fine, and I've been using them in production for awhile.

I've been working with the new Customizer API, and I just discovered the "shift-click to edit" functionality. However, none of my custom widgets work properly with this feature.

I'm aware of the current limitation of needing the widgets panel to be open for the clicked widget to properly bring focus in the panel: the default widgets are working as they should.

I've been scouring over source to try and figure out how this works, with no luck.

What controls this behavior when registering a widget?

  • It's a bug in WP 4.0.1 that's been fixed for 4.1 trac #29529.
    – bonger
    Dec 14 '14 at 6:51
  • No, that was for the "current limitation" I spoke of. 4.1 is here, and my custom widgets still won't open when shift clicking.
    – SkyShab
    Dec 26 '14 at 12:41
  • Oh, mine do now and weren't before (though that was for all widgets, not just custom ones). Perhaps there's a javascript error? Anyway, there's no attaching of listeners necessary, it should be all automatic...
    – bonger
    Dec 29 '14 at 19:13
  • Huh. There must be something that needs to be setup a certain way when registering the custom widgets, that I am not doing. No errors showing in the console. I might need to update my question to focus more on what specifically enables this when registering the widget. Thanks for the clue!
    – SkyShab
    Dec 30 '14 at 15:05

In my custom widgets, I had omitted adding the ID to 'before_widget' markup, as I wasn't using the IDs for styling. Turns out this is what the Customizer JS is using to target the widgets. (duh)

So, including the proper ID in the widget output makes everything work as it should.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.