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 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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