mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
REST API: Fire actions after items are completely updated/inserted.
The existing `rest_insert_*` actions are fired before meta and additional fields are updated. These new `rest_after_*` actions fire after all write operations have completed. Props timothyblynjacobs, danielbachhuber. Merges [43737] to trunk. Fixes #42864. git-svn-id: https://develop.svn.wordpress.org/trunk@43987 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -566,6 +566,17 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||
|
||||
$request->set_param( 'context', 'edit' );
|
||||
|
||||
/**
|
||||
* Fires after a user is completely created or updated via the REST API.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_User $user Inserted or updated user object.
|
||||
* @param WP_REST_Request $request Request object.
|
||||
* @param bool $creating True when creating a user, false when updating.
|
||||
*/
|
||||
do_action( 'rest_after_insert_user', $user, $request, true );
|
||||
|
||||
$response = $this->prepare_item_for_response( $user, $request );
|
||||
$response = rest_ensure_response( $response );
|
||||
|
||||
@@ -689,6 +700,9 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||
|
||||
$request->set_param( 'context', 'edit' );
|
||||
|
||||
/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php */
|
||||
do_action( 'rest_after_insert_user', $user, $request, false );
|
||||
|
||||
$response = $this->prepare_item_for_response( $user, $request );
|
||||
$response = rest_ensure_response( $response );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user