rest_delete_widget WordPress Action Hook

The `rest_delete_widget` hook is called when a widget is deleted via the REST API. It allows plugins to cleanup after themselves when a widget is deleted. This hook is important for plugin developers because it allows them to run cleanup code when a widget is deleted. This is especially important for plugins that store data in the database. If a plugin doesn't cleanup after itself when a widget is deleted, it could cause data loss or other problems.

do_action( 'rest_delete_widget', string $widget_id, string $sidebar_id, WP_REST_Response|WP_Error $response, WP_REST_Request $request ) #

Fires after a widget is deleted via the REST API.


Parameters

$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.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.