[wp-trac] [WordPress Trac] #53489: Widgets: Registered sidebar not showing in the widget editor
WordPress Trac
noreply at wordpress.org
Thu Jun 24 14:10:59 UTC 2021
#53489: Widgets: Registered sidebar not showing in the widget editor
-------------------------------------------------+-------------------------
Reporter: walbo | Owner:
| hellofromTonya
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.8
Component: Widgets | Version: trunk
Severity: normal | Resolution:
Keywords: needs-testing has-patch has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by hellofromTonya):
== Testing after applying PR
Env:
- OS: macOS Big Sur
- WordPress: trunk with PR 1422 applied
- Plugins: none
- Theme: Twenty Twenty-One
- Browser: Chrome (in gif), Safari, Firefox
Script:
The following code is added to `wp-content/mu-plugins/test53489.php`.
{{{#!php
<?php
add_action( 'widgets_init', function() {
register_sidebar(
array(
'name' => 'Announcements',
'id' => 'announcements',
)
);
register_sidebar(
array(
'name' => 'In Post CTA',
'id' => 'in-post-cta',
)
);
} );
add_action( 'widgets_init', function() {
register_sidebar(
array(
'name' => 'Footer 2',
'id' => 'footer-2',
)
);
register_sidebar(
array(
'name' => 'Footer 3',
'id' => 'footer-3',
)
);
}, 20 );
}}}
=== Test 1: Registering new sidebars:
**Expected behavior:**
- Should remove the sidebar and move its widgets to the `Inactive widgets`
sidebar.
- No errors.
**Testing steps:**
- Comment out each of the sidebars in the supplied must use file.
- Start with a fresh install and add 2 extra posts.
- Go to `Appearance` > `Widgets`. Notice the default sidebars: `Footer`
and `Inactive widgets`. There should be no widgets in the `Inactive
widgets` area.
- Uncomment the `Announcements` sidebar in the must use file.
- Refresh the `Widgets` screen. Notice the new `Announcements` sidebar is
available.
- Add a paragraph block to it with some test.
- Click on `Update`. Then refresh the screen. => Notice: the state of the
widgets is retained.
- Repeat the process with each of the new sidebar registrations.
For my test, I also added the sidebars into the theme for them to display
in the frontend and set the color to red for quick viewing.
**Actual Behavior:**
- New registered sidebars appear upon refreshing or viewing the `Widgets`
screen ✅
- Widgets retain the location in each of the sidebars ✅
- No console errors ✅
- Nothing in the `debug.log` ✅
Works as expected ✅
=== Test 2: Removing a sidebar:
**Expected behavior:**
- Should remove the sidebar and move its widgets to the `Inactive widgets`
sidebar.
- No errors.
**Testing steps:**
- Comment out the `Announcements` sidebar registration in the must-use
plugin.
- Refresh the `Widgets` screen => Notice the `Announcements` sidebar no
longer appears in the screen or in the frontend.
- Expand the `Inactive widgets` sidebar => Notice: The paragraph widget
from `Announcements` appears in this area.
- Repeat with each of the sidebars.
**Actual behavior:**
- Sidebar is removed ✅
- Widgets now appear in `Inactive widgets` sidebar ✅
- No console errors ✅
- Nothing in the `debug.log` ✅
Works as expected ✅
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53489#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list