How do you register a sidebar in a plugin without screwing up the pre-existing registered sidebars? (The ordering of the sidebar registrations, rather than the assigned ID, determines the sidebar data.)
1 Answer
function self_deprecating_sidebar_registration(){
register_sidebar( /* Your arguments here */ );
}
add_action( 'wp_loaded', 'self_deprecating_sidebar_registration' );
Most themes will register the sidebar in their functions file, which is included before init
but after plugins are loaded. Hooking onto wp_loaded
should guarantee that your sidebar is registered after the theme's.
-
I should also add that
wp_loaded
is the latest hook you can reliably use to register the sidebar for both admin and front end. Oct 4, 2010 at 16:46 -
-
Also, can we get some action on this? core.trac.wordpress.org/ticket/14256 Oct 4, 2010 at 17:24
-
If you can, attend the IRC dev chat on Thurs and mention the ticket. Or email a core dev. Or bring it up on the wp-hackers list.– EAMannOct 4, 2010 at 17:33