WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
493 | /** |
494 | * Fires immediately after a user is created or updated via the REST API. |
495 | * |
496 | * @since 4.7.0 |
497 | * |
498 | * @param WP_User $user Inserted or updated user object. |
499 | * @param WP_REST_Request $request Request object. |
500 | * @param bool $creating True when creating a user, false when updating. |
501 | */ |
502 | do_action( 'rest_insert_user', $user, $request, true ); |
503 |
|
504 | if ( ! empty( $request['roles'] ) && ! empty( $schema['properties']['roles'] ) ) { |
505 | array_map( array( $user, 'add_role' ), $request['roles'] ); |
506 | } |
507 |
|
508 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
509 | $meta_update = $this->meta->update_value( $request['meta'], $user_id ); |
510 |
|
511 | if ( is_wp_error( $meta_update ) ) { |
Line | Code |
600 | $user_id = wp_update_user( wp_slash( (array) $user ) ); |
601 |
|
602 | if ( is_wp_error( $user_id ) ) { |
603 | return $user_id; |
604 | } |
605 |
|
606 | $user = get_user_by( 'id', $user_id ); |
607 |
|
608 | /* This action is documented in lib/endpoints/class-wp-rest-users-controller.php */ |
609 | do_action( 'rest_insert_user', $user, $request, false ); |
610 |
|
611 | if ( is_multisite() && ! is_user_member_of_blog( $id ) ) { |
612 | add_user_to_blog( get_current_blog_id(), $id, '' ); |
613 | } |
614 |
|
615 | if ( ! empty( $request['roles'] ) ) { |
616 | array_map( array( $user, 'add_role' ), $request['roles'] ); |
617 | } |
618 |
|