rest_after_save_widget хук-событиеWP 5.8.0

Fires after a widget is created or updated via the REST API.

Использование

add_action( 'rest_after_save_widget', 'wp_kama_rest_after_save_widget_action', 10, 4 );

/**
 * Function for `rest_after_save_widget` action-hook.
 * 
 * @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            $creating   True when creating a widget, false when updating.
 *
 * @return void
 */
function wp_kama_rest_after_save_widget_action( $id, $sidebar_id, $request, $creating ){

	// action...
}
$id(строка)
ID of the widget being saved.
$sidebar_id(строка)
ID of the sidebar containing the widget being saved.
$request(WP_REST_Request)
Request object.
$creating(true|false)
True when creating a widget, false when updating.

Список изменений

С версии 5.8.0 Введена.

Где вызывается хук

WP_REST_Widgets_Controller::save_widget()
rest_after_save_widget
wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php 649
do_action( 'rest_after_save_widget', $id, $sidebar_id, $request, $creating );

Где используется хук в WordPress

wp-includes/default-filters.php 276
add_action( $action, '_delete_option_fresh_site', 0 );