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 |
---|---|
558 |
|
559 | /** |
560 | * Fires immediately after the user has been given a new role. |
561 | * |
562 | * @since 4.3.0 |
563 | * |
564 | * @param int $user_id The user ID. |
565 | * @param string $role The new role. |
566 | */ |
567 | do_action( 'add_user_role', $this->ID, $role ); |
568 | } |
569 |
|
570 | /** |
571 | * Removes role from user. |
572 | * |
573 | * @since 2.0.0 |
574 | * |
575 | * @param string $role Role name. |
576 | */ |
Line | Code |
633 | continue; |
634 | } |
635 |
|
636 | /** This action is documented in wp-includes/class-wp-user.php */ |
637 | do_action( 'remove_user_role', $this->ID, $old_role ); |
638 | } |
639 |
|
640 | if ( $role && ! in_array( $role, $old_roles, true ) ) { |
641 | /** This action is documented in wp-includes/class-wp-user.php */ |
642 | do_action( 'add_user_role', $this->ID, $role ); |
643 | } |
644 |
|
645 | /** |
646 | * Fires after the user's role has changed. |
647 | * |
648 | * @since 2.9.0 |
649 | * @since 3.6.0 Added $old_roles to include an array of the user's previous roles. |
650 | * |
651 | * @param int $user_id The user ID. |