WordPress Hooks Explorer

Listing all hooks extracted WordPress Core


Details about delete_widget

Back to home

Files

Filename Hook Type Line Number PHP Doc
wp-admin/widgets-form.php do_action 169 /**
* Fires immediately after a widget has been marked for deletion.
*
* @since 4.4.0
*
* @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 string $id_base ID base for the widget.
*/
wp-admin/includes/ajax-actions.php do_action 2374 /**
* Fires early when editing the widgets displayed in sidebars.
*
* @since 2.8.0
*/
wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php do_action 413 /**
* Deletes a widget.
*
* @since 5.8.0
*
* @global WP_Widget_Factory $wp_widget_factory
* @global array $wp_registered_widget_updates The registered widget update functions.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
public function delete_item( $request ) {
global $wp_widget_factory, $wp_registered_widget_updates;

/*
* retrieve_widgets() contains logic to move "hidden" or "lost" widgets to the
* wp_inactive_widgets sidebar based on the contents of the $sidebars_widgets global.
*
* When batch requests are processed, this global is not properly updated by previous
* calls, resulting in widgets incorrectly being moved to the wp_inactive_widgets
* sidebar.
*
* See https://core.trac.wordpress.org/ticket/53657.
*/

Hook Parameters

Parameter Type Name Description
string $widget_id ID of the widget marked for deletion.
string $sidebar_id ID of the sidebar the widget was deleted from.
string $id_base ID base for the widget.