Your code works when I test it. I can only assume that the registration code is being hooked into the system too early or too late. register_sidebar()
should be hooked on widgets_init
per the Codex. Therefore:
function register_header_sidebar_wpse_190618() {
register_sidebar(
array(
'id' => 'header-sidebar',
'name' => 'Header',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
add_action( 'widgets_init', 'register_header_sidebar_wpse_190618' );
Related Posts:
- What is allowed as an id argument in register_sidebar( $args )
- register_sidebar notice [closed]
- is_active_sidebar() not working
- register_sidebar function problem
- Registering Sidebar. Additional banners got displayed
- Get list of all registered sidebars
- Text Widget creates a
- HowTo: Add Class to Sidebar Widget List-Items
- How to wrap the widget content with a div or get the widget title outside?
- Get sidebar parameters (before_widget, before_title, etc.) from within a widget
- How to register_sidebar() without messing up the order?
- register_sidebar ignores ‘id’ and ‘class’
- dynamic_sidebar not rendering sidebar
- Get custom side bar on custom post archive page
- Add div class to only one widget
- What is the use case for the “Class” parameter in register_sidebar?
- How to avoid widgets added to sidebar on theme activation?
- Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying
- Hooking Into Widget Output Loop
- How the WordPress sidebar works
- Custom sidebar not showing in the dashboard
- Why do none of my widgets have a title?
- Widget area inside a widget
- how do I get a sidebar’s id or number for use with is_active_sidebar()
- Registering multiple sidebars with data from an array
- Best practices: Custom theme sidebar menu – hardcode or widget?
- More flexible sidebar and widget management
- WordPress widget new instance creates content duplicates
- duplicate sidebar
- Removing custom widget area WordPress 4.4 [closed]
- What are ideal hooks to call register_sidebars?
- Add before_content and after_content to register_sidebar
- I can’t get my custom widget area to show on my WordPress site
- How can you add a link to a sidebar description?
- Cannot save widgets in custom sidebars
- unregister_sidebar() in stand-alone theme not working
- WordPress widget/sidebar dividers?
- adding multiple sidebars on pages
- How do I override a sidebar that is registered in a parent theme when using a child theme?
- Toggle option in sidebar widgets
- Register a sidebar in a WordPress plugin
- Can’t see widget areas in my customizer
- Widgets not activated alert after using get_sidebar()
- Custom page sidebar using Template dropdown box
- How to display custom sidebar in wordpress 5.5.2
- Can you target a widget_class in a register_sidebar?
- Adding Multiple Sidebars
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- How to increase maximum number of sidebars support?
- Copy Widget Settings because of changed IDs
- How to enable the default sidebar area?
- 2 dynamic sidebars registered, not showing up
- Custom Sidebar only on single post
- Add #sidebar-2 to a custom page template
- Sidebar widget not displaying after simple code update.
- Register sidebar ‘before’ and ‘after’ html as div rather than li tags
- Dynamic sidebar rendered in another place than i would like
- How to pass a special CSS class into widget li
- Widget title markup in register_sidebar
- finding sidebar content in wordpress
- Add SideBar/Widgets Just Below the Post
- Add class to on sidebar widget
- Save button is not working on custom widget
- Register_Sidebar overwriting itself and doesn’t exist in global $wp_registered_sidebars;
- How can i display custom menu in sidebar?
- Adding an extra sidebar to your theme
- widgets not working
- Is there a way to dump all registered sidebar/widget?
- Sidebar widgets – dynamic CSS : problem with widget-title
- How to troubleshoot Sidebar not being generated
- How to customize wordpress sidebar widget
- activate custom sidebar widgets
- Why is my custom sidebar always open on the widgets screen in Admin?
- Custom sidebars – get_sidebar() problems
- Content not showing up when using custom template + sidebar
- Displaying registered sidebar after post content
- How to use register_sidebar’s ‘before_widget’ unique id generator into its other parameters like ‘before_title’?
- After adding widget the style is messing up
- Widget is displayed in two places
- How to make sidebar float right and site content left
- Siderbar implementation with collapsible bootstrap cards
- How to create sidebar from “scratch”?
- My widgets do not save
- Dynamic sidebar areas not working on the Theme Customizer
- How Can I Replicate & Register a Widget from the Child Theme
- WordPress Bootstrap Grid
- Create new sidebars trough admin post/page metabox
- Call Multiple Sidebars at once
- Widget Areas Still Appearing in WP ADMIN When They Shouldn’t
- $before/after_widget/title not displaying anything
- Why isn’t my registered sidebar showing up in the admin?
- wp_register_sidebar_widget in loop within a plugin?
- register_sidebar() will not wrap an element properly
- key( $GLOBALS[‘wp_registered_sidebars’] ) is always showing the same value
- How to create multiple sidebar areas with a forloop and register_sidebars?
- Showing sidebar-2 on custom template page
- An issue with register_sidebar and the admin interface
- Move wordpress sidebar on homepage up to new position
- Unique widget id in sidebar
- is it possible to create custom widgets page in admin?