Widgets REST API: Fix non-multi widgets not appearing in wp_inactive_widgets
Registered widgets that do not extend WP_Widget should appear in the wp_inactive_widgets sidebar by default. Having the widgets REST API call retrieve_widgets() before serving any request ensures that this will happen. This is a similar fix to [51235]. Fixes #53534. Props zieladam, timothyblynjacobs. Built from https://develop.svn.wordpress.org/trunk@51248 git-svn-id: http://core.svn.wordpress.org/trunk@50857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c26143ea2e
commit
7131a90b0a
|
@ -109,6 +109,8 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
|||
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
retrieve_widgets();
|
||||
|
||||
$prepared = array();
|
||||
|
||||
foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) {
|
||||
|
@ -149,6 +151,8 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
|||
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
retrieve_widgets();
|
||||
|
||||
$widget_id = $request['id'];
|
||||
$sidebar_id = wp_find_widgets_sidebar( $widget_id );
|
||||
|
||||
|
@ -230,6 +234,8 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
|||
public function update_item( $request ) {
|
||||
global $wp_widget_factory;
|
||||
|
||||
retrieve_widgets();
|
||||
|
||||
$widget_id = $request['id'];
|
||||
$sidebar_id = wp_find_widgets_sidebar( $widget_id );
|
||||
|
||||
|
@ -291,6 +297,8 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
|||
public function delete_item( $request ) {
|
||||
global $wp_registered_widget_updates;
|
||||
|
||||
retrieve_widgets();
|
||||
|
||||
$widget_id = $request['id'];
|
||||
$sidebar_id = wp_find_widgets_sidebar( $widget_id );
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-beta4-51247';
|
||||
$wp_version = '5.8-beta4-51248';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue