rest_insert_user хук-событиеWP 4.7.0

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

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

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.

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

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

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

WP_REST_Users_Controller::create_item()
rest_insert_user
WP_REST_Users_Controller::update_item()
rest_insert_user
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 618
do_action( 'rest_insert_user', $user, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 776
do_action( 'rest_insert_user', $user, $request, false );

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

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