Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh $sidebars_widgets before calling retrieve_widgets in WP_REST_Widgets_Controller a safe, RC-friendly way #1498

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ public function update_item_permissions_check( $request ) {
public function update_item( $request ) {
global $wp_widget_factory;

// Calling wp_get_sidebars_widgets() here is a safe fix for https://github.com/WordPress/gutenberg/issues/33335
// @TODO: Remove this after WP 5.8 RC1 in favor of updating retrieve_widgets and wp_set_sidebars_widgets
wp_get_sidebars_widgets();

retrieve_widgets();

$widget_id = $request['id'];
Expand Down Expand Up @@ -300,6 +304,10 @@ public function delete_item_permissions_check( $request ) {
public function delete_item( $request ) {
global $wp_widget_factory, $wp_registered_widget_updates;

// Calling wp_get_sidebars_widgets() here is a safe fix for https://github.com/WordPress/gutenberg/issues/33335
// @TODO: Remove this after WP 5.8 RC1 in favor of updating retrieve_widgets and wp_set_sidebars_widgets
wp_get_sidebars_widgets();

retrieve_widgets();

$widget_id = $request['id'];
Expand Down