Anyone know how I can register a sidebar (I like to call them “Locations” now) and have it only visible in the Customizer? I would like to keep it out of the widgets.php screen as it’s a location(s) oriented for one specific template.
From looking through the code, sidebars are not designed for conditional registration, so you’re going to have to get a bit creative.
The simplest way I can see to make this work is to use
add_action( 'widgets_admin_page' )
to unregister the sidebar immediately before the available sidebars are shown (source).
1 Like
Thank you.
Weekend project is on
1 Like
OK, for now I’ve settle with if( ! is_admin() || is_customize_preview() )
check to keep the sidebars out of the widgets screen but be still available in the Customizer.
Feels a bit hacky but it works for the purpose
1 Like
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.