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 |
|---|---|
| 661 | /** |
| 662 | * Fires immediately after a user is created or updated via the REST API. |
| 663 | * |
| 664 | * @since 4.7.0 |
| 665 | * |
| 666 | * @param WP_User $user Inserted or updated user object. |
| 667 | * @param WP_REST_Request $request Request object. |
| 668 | * @param bool $creating True when creating a user, false when updating. |
| 669 | */ |
| 670 | do_action( 'rest_insert_user', $user, $request, true ); |
| 671 | |
| 672 | if ( ! empty( $request['roles'] ) && ! empty( $schema['properties']['roles'] ) ) { |
| 673 | array_map( array( $user, 'add_role' ), $request['roles'] ); |
| 674 | } |
| 675 | |
| 676 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
| 677 | $meta_update = $this->meta->update_value( $request['meta'], $user_id ); |
| 678 | |
| 679 | if ( is_wp_error( $meta_update ) ) { |
| Line | Code |
| 816 | $user_id = wp_update_user( wp_slash( (array) $user ) ); |
| 817 | |
| 818 | if ( is_wp_error( $user_id ) ) { |
| 819 | return $user_id; |
| 820 | } |
| 821 | |
| 822 | $user = get_user_by( 'id', $user_id ); |
| 823 | |
| 824 | /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php */ |
| 825 | do_action( 'rest_insert_user', $user, $request, false ); |
| 826 | |
| 827 | if ( ! empty( $request['roles'] ) ) { |
| 828 | array_map( array( $user, 'add_role' ), $request['roles'] ); |
| 829 | } |
| 830 | |
| 831 | $schema = $this->get_item_schema(); |
| 832 | |
| 833 | if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) { |
| 834 | $meta_update = $this->meta->update_value( $request['meta'], $id ); |