register sidebar – Why do none of my widgets have a title?


I’ve never seen this issue before, so it could either be a mistake on my part, or a very recent change to WP core, but either way it doesn’t make sense for me.

Like usual, I register widgets like I always have:

// Register Widgets
function pr_widgets_init() {

        'name'          => 'Sidebar',
        'id'            => 'sidebar-widgets',
        'before_widget' => '<div id="%1$s" class="bg-light rounded p-4 mb-4 widget-container %2$s">',
        'after_widget'  => '</div>',
        'before_title'  => '<h3 class="h5 mb-3 text-primary"><span class="border-bottom">',
        'after_title'   => '</span></h3>',

add_action('widgets_init', 'pr_widgets_init');

And then place on the template the same way I always have again:

if(is_active_sidebar('sidebar-widgets')) {

However, there is no title on the front end for any of the widgets, even when looking at the page source.

What’s more, when viewing them in WP-Admin (where it visually previews it), there are no titles showing here either.

enter image description here

enter image description here

Is this a WP bug, or have I completely missed something out? There’s no option in the widget editor to add a title, or change the title either.

Would be very grateful for any help, tips or ideas at this point.

in progress 0
Lee 11 months 2021-09-14T05:49:53-05:00 0 Answer 0 views 0

Answer ( 1 )


    WordPress 5.8 added the ability to add Blocks to sidebars. Blocks do not use the title and markup defined for a sidebar. They just use the normal HTML they would use in the editor. “Legacy” widgets can still be added, and should still have the option to enter a title and use the markup defined for that widget area.

    WordPress is moving towards using blocks for everything, so some of this behaviour will change. The “new” way to handle this use case might be to create a wrapper Block that has a title field and an area for adding blocks. Or you could just use heading blocks.

Leave an answer