How to register_sidebar() without messing up the order?

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.

Leave a Comment