WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Where should a plugin ideally hook to call register_sidebar();?

Will init do just fine?

function my_plugin_register_sidebars() {
    $args = array(
        'name' => 'foo'
        'description' => 'bar'
    register_sidebar( $args );
add_action( '**????**', 'my_plugin_register_sidebar' );
share|improve this question
up vote 5 down vote accepted

Twenty Eleven and Twenty Twelve use the widgets_init action. Given that these themes are generally considered to use best practices for theme development, I think this hook would be ideal.

share|improve this answer
add_action( 'init', 'my_plugin_register_sidebar' );

Edit: @Brasofilo - the init is used to register menus, I figured it could also be used to register other stuff. I could be wrong though since I don't develop themes. An explanation of why using "init" is wrong would help me in the future. http://codex.wordpress.org/Navigation_Menus

share|improve this answer
Can you give a reference for using this hook? The Codex points to this article that indicates widgets_init... – brasofilo Jul 22 '12 at 17:31

Your Answer


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.