- Timestamp:
- 06/30/2021 10:40:21 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
r51248 r51277 290 290 * @since 5.8.0 291 291 * 292 * @global array $wp_registered_widget_updates The registered widget update functions. 292 * @global array $wp_registered_widget_updates The registered widget update functions. 293 * @global WP_Widget_Factory $wp_widget_factory 293 294 * 294 295 * @param WP_REST_Request $request Full details about the request. … … 296 297 */ 297 298 public function delete_item( $request ) { 298 global $wp_registered_widget_updates ;299 global $wp_registered_widget_updates, $wp_widget_factory; 299 300 300 301 retrieve_widgets(); … … 344 345 $_POST = $original_post; 345 346 $_REQUEST = $original_request; 347 348 $widget_object = $wp_widget_factory->get_widget_object( $id_base ); 349 350 if ( $widget_object ) { 351 /* 352 * WP_Widget sets `updated = true` after an update to prevent more than one widget 353 * from being saved per request. This isn't what we want in the REST API, though, 354 * as we support batch requests. 355 */ 356 $widget_object->updated = false; 357 } 346 358 347 359 wp_assign_widget_to_sidebar( $widget_id, '' ); … … 521 533 $widget_object->_register_one( $number ); 522 534 523 // WP_Widget sets updated = true after an update to prevent more 524 // than one widget from being saved per request. This isn't what we 525 // want in the REST API, though, as we support batch requests. 535 /* 536 * WP_Widget sets `updated = true` after an update to prevent more than one widget 537 * from being saved per request. This isn't what we want in the REST API, though, 538 * as we support batch requests. 539 */ 526 540 $widget_object->updated = false; 527 541 }
Note: See TracChangeset
for help on using the changeset viewer.