layers-wp / layerswp

Layers WordPress theme by Obox
http://www.layerswp.com
Other
23 stars 10 forks source link

Why not register builder sidebars only when needed? #348

Closed easterncoder closed 8 years ago

easterncoder commented 8 years ago

Hi,

I noticed that for each new builder page I create, the customizer document size grows. So I tried creating 20 builder pages and was surprised that the document size for the customizer grew to 12M+.

Looking into the code, I noticed that we register all builder sidebars in core/widgets/init.php in the register_sidebars() and register_builder_sidebar() functions.

Why not just check for the current page being edited in the customizer and just register the sidebar for that builder page? The only thing I can think of that might be affected is that the builder sidebars won't show up in the WP admin widgets area but I think that's OK since the forms don't look good in the widgets area anyway.

Thoughts?

Mike

marcperel commented 8 years ago

Hey @easterncoder,

The WordPress Customizer loads every sidebar in it so that you can switch between pages on-the-fly, when you click save every single widget is saved at once, much like the Appearance > Widgets page.

We'd also prefer to deal with one page at a time but this is how WP works, we haven't found an alternative method yet which doesn't go against default WP functionality.