[wp-trac] [WordPress Trac] #53660: `$sidebar_widgets` out of sync during batch updates to widgets through the REST API

WordPress Trac noreply at wordpress.org
Wed Jul 14 16:51:22 UTC 2021


#53660: `$sidebar_widgets` out of sync during batch updates to widgets through the
REST API
--------------------------+-------------------------
 Reporter:  desrosj       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  5.8.1
Component:  Widgets       |    Version:  trunk
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:  rest-api      |
--------------------------+-------------------------
 Continuation of #53657.

 From @adamziel on https://github.com/WordPress/wordpress-
 develop/pull/1498:
 > `retrieve_widgets()` runs some logic to move "hidden/lost" widgets to
 `wp_inactive_widgets` sidebar. It does so based on the global
 `$sidebars_widgets`. Normally this is not a problem, but when processing
 batch requests, `$sidebars_widgets` isn't properly updated by a previous
 call to `WP_REST_Widgets_Controller::create_item()` – only global
 `$_wp_sidebars_widgets` has been changed. So, as far as
 `retrieve_widgets()` is concerned, the last created widget isn't assigned
 to any sidebar and so it is mistakenly moved to the `wp_inactive_widgets`
 sidebar.

 [51432] provided a temporary, "RC friendly" fix to the issue for 5.8. But
 a better, more permanent solution should be explored for a future release.

 See also:
 - https://github.com/WordPress/gutenberg/issues/33335

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53660>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list