rest_delete_widget
Fires after a widget is deleted via the REST API.
Usage
add_action( 'rest_delete_widget', 'wp_kama_rest_delete_widget_action', 10, 4 ); /** * Function for `rest_delete_widget` action-hook. * * @param string $widget_id ID of the widget marked for deletion. * @param string $sidebar_id ID of the sidebar the widget was deleted from. * @param WP_REST_Response|WP_Error $response The response data, or WP_Error object on failure. * @param WP_REST_Request $request The request sent to the API. * * @return void */ function wp_kama_rest_delete_widget_action( $widget_id, $sidebar_id, $response, $request ){ // action... }
- $widget_id(string)
- ID of the widget marked for deletion.
- $sidebar_id(string)
- ID of the sidebar the widget was deleted from.
- $response(WP_REST_Response|WP_Error)
- The response data, or WP_Error object on failure.
- $request(WP_REST_Request)
- The request sent to the API.
Changelog
Since 5.8.0 | Introduced. |
Where the hook is called
rest_delete_widget
wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php 468
do_action( 'rest_delete_widget', $widget_id, $sidebar_id, $response, $request );
Where the hook is used in WordPress
wp-includes/default-filters.php 285
add_action( $action, '_delete_option_fresh_site', 0 );