Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.)

share|improve this question

1 Answer 1

up vote 5 down vote accepted
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.

share|improve this answer
    
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. –  John P Bloch Oct 4 '10 at 16:46
    
Sick. I was about to look up that same information. Thanks! –  Dan Gayle Oct 4 '10 at 17:21
    
Also, can we get some action on this? core.trac.wordpress.org/ticket/14256 –  Dan Gayle Oct 4 '10 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. –  EAMann Oct 4 '10 at 17:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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