From 47231831f726c797566026b262426cd4495c27ad Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 4 Jun 2021 23:13:59 +0000 Subject: [PATCH] REST API: Restore the `$creating` parameter of `rest_after_save_widget` action. This is consistent with other similar REST API actions. Partially reverts [51071], except for DocBlock formatting fixes. Props TimothyBlynJacobs. See #53317. Built from https://develop.svn.wordpress.org/trunk@51074 git-svn-id: http://core.svn.wordpress.org/trunk@50683 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../endpoints/class-wp-rest-widgets-controller.php | 8 ++++---- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php index be84173feb..29daf4b1d9 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php @@ -414,14 +414,14 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { $id_base = $parsed_id['id_base']; $number = isset( $parsed_id['number'] ) ? $parsed_id['number'] : null; $widget_object = $wp_widget_factory->get_widget_object( $id_base ); - $update = true; + $creating = false; } elseif ( $request['id_base'] ) { // Saving a new widget. $id_base = $request['id_base']; $widget_object = $wp_widget_factory->get_widget_object( $id_base ); $number = $widget_object ? next_widget_id_number( $id_base ) : null; $id = $widget_object ? $id_base . '-' . $number : $id_base; - $update = false; + $creating = true; } else { return new WP_Error( 'rest_invalid_widget', @@ -525,9 +525,9 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller { * @param string $id ID of the widget being saved. * @param string $sidebar_id ID of the sidebar containing the widget being saved. * @param WP_REST_Request $request Request object. - * @param bool $update Whether this is an existing widget being updated. + * @param bool $creating True when creating a widget, false when updating. */ - do_action( 'rest_after_save_widget', $id, $sidebar_id, $request, $update ); + do_action( 'rest_after_save_widget', $id, $sidebar_id, $request, $creating ); return $id; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 249ef7dc1f..e796db5d1f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-51073'; +$wp_version = '5.8-alpha-51074'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.