[wp-trac] [WordPress Trac] #53489: Widgets: Registered sidebar not showing in the widget editor
WordPress Trac
noreply at wordpress.org
Wed Jun 23 23:00:46 UTC 2021
#53489: Widgets: Registered sidebar not showing in the widget editor
---------------------------+---------------------
Reporter: walbo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.8
Component: Widgets | Version:
Severity: normal | Resolution:
Keywords: needs-testing | Focuses:
---------------------------+---------------------
Comment (by hellofromTonya):
Interesting finding:
When `WP_REST_Sidebars_Controller::get_items()` is invoked, here are the
states:
- global `$wp_registered_sidebars` has all of the sidebars registered in
the theme via `register_sidebar`
- `get_option( 'sidebars_widgets', array() )` does not have the new
sidebars as they haven't been updated yet
- In the classic `widgets-form.php`, it's invoking `retrieve_widgets()`
which updates global state to reflect only the registered sidebars.
[https://github.com/WordPress/wordpress-develop/blob/master/src/wp-admin
/widgets-form.php#L121 See it here].
As a test, I added `retrieve_widgets()` to the top of
`WP_REST_Sidebars_Controller::get_items()` ([https://github.com/WordPress
/wordpress-develop/blob/ed84ca68aa61300e5dcdff603d8cf9ede6442f6d/src/wp-
includes/rest-api/endpoints/class-wp-rest-sidebars-
controller.php#L100-L101 here]. Refreshed, and, bam, the registered
sidebars displayed properly.
Doing testing to validate if this solves the problem without creating
other problems or side effects.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53489#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list