Action hook 'rest_after_save_widget'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php at line 654

View Source

rest_after_save_widget

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

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php View on GitHub
Hook Type Action
Line Number 654

Hook Parameters

Type Name Description
string $id ID of the widget being saved.
string $sidebar_id ID of the sidebar containing the widget being saved.
WP_REST_Request $request Request object.
bool $creating True when creating a widget, false when updating.

Usage Examples

Basic Usage
<?php
// Hook into rest_after_save_widget
add_action('rest_after_save_widget', 'my_custom_function', 10, 4);

function my_custom_function($id, $sidebar_id, $request, $creating) {
    // Your custom code here
}

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php:654 - How this hook is used in WordPress core
<?php
 649  		 * @param string          $id         ID of the widget being saved.
 650  		 * @param string          $sidebar_id ID of the sidebar containing the widget being saved.
 651  		 * @param WP_REST_Request $request    Request object.
 652  		 * @param bool            $creating   True when creating a widget, false when updating.
 653  		 */
 654  		do_action( 'rest_after_save_widget', $id, $sidebar_id, $request, $creating );
 655  
 656  		return $id;
 657  	}
 658  
 659  	/**

PHP Documentation

<?php
/**
		 * Fires after a widget is created or updated via the REST API.
		 *
		 * @since 5.8.0
		 *
		 * @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.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 4
  • File: wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
Related Hooks

Related hooks will be displayed here in future updates.