unregister_sidebar() in stand-alone theme not working
Thanks to Milo and G.M. for pointing to the master key, as G.M. said: you have to use a lower priority than one register_sidebar runs, but lower priority means higher number. So the final code that is working: function site_unregister_sidebar() { if ( is_admin() && current_user_can(‘editor’) ) { unregister_sidebar( ‘my_custom_widget_area’ ); } } add_action(‘widgets_init’, ‘site_unregister_sidebar’, … Read more