REST API: Add 'delete_widget' action to delete widget endpoint

Triggers the 'delete_widget' action to the delete widget endpoint in the REST
API. This aligns with the behaviour in the widgets WP Admin screen.

Fixes #53289.
Props isabel_brison, TimothyBlynJacobs.

Built from https://develop.svn.wordpress.org/trunk@51060


git-svn-id: http://core.svn.wordpress.org/trunk@50669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
noisysocks 2021-06-02 01:40:57 +00:00
parent 2fd3f23408
commit 5162c8e6a8
2 changed files with 4 additions and 1 deletions

View File

@ -321,6 +321,9 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
);
$_REQUEST = $_POST;
/** This action is documented in wp-admin/widgets-form.php */
do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base );
$callback = $wp_registered_widget_updates[ $id_base ]['callback'];
$params = $wp_registered_widget_updates[ $id_base ]['params'];

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-51059';
$wp_version = '5.8-alpha-51060';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.