rest_insert_user
Fires immediately after a user is created or updated via the REST API.
Usage
add_action( 'rest_insert_user', 'wp_kama_rest_insert_user_action', 10, 3 ); /** * Function for `rest_insert_user` action-hook. * * @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. * * @return void */ function wp_kama_rest_insert_user_action( $user, $request, $creating ){ // action... }
- $user(WP_User)
- Inserted or updated user object.
- $request(WP_REST_Request)
- Request object.
- $creating(true|false)
- True when creating a user, false when updating.
Changelog
Since 4.7.0 | Introduced. |
Where the hook is called
rest_insert_user
rest_insert_user
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 631
do_action( 'rest_insert_user', $user, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 786
do_action( 'rest_insert_user', $user, $request, false );