add_user_to_blog
Action HookDescription
Fires immediately after a user is added to a site.Hook Information
File Location |
wp-includes/ms-functions.php
View on GitHub
|
Hook Type | Action |
Line Number | 211 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$user_id
|
User ID. |
string
|
$role
|
User role. |
int
|
$blog_id
|
Blog ID. |
Usage Examples
Basic Usage
<?php
// Hook into add_user_to_blog
add_action('add_user_to_blog', 'my_custom_function', 10, 3);
function my_custom_function($user_id, $role, $blog_id) {
// Your custom code here
}
Source Code Context
wp-includes/ms-functions.php:211
- How this hook is used in WordPress core
<?php
206 *
207 * @param int $user_id User ID.
208 * @param string $role User role.
209 * @param int $blog_id Blog ID.
210 */
211 do_action( 'add_user_to_blog', $user_id, $role, $blog_id );
212
213 clean_user_cache( $user_id );
214 wp_cache_delete( $blog_id . '_user_count', 'blog-details' );
215
216 restore_current_blog();
PHP Documentation
<?php
/**
* Fires immediately after a user is added to a site.
*
* @since MU (3.0.0)
*
* @param int $user_id User ID.
* @param string $role User role.
* @param int $blog_id Blog ID.
*/
Quick Info
- Hook Type: Action
- Parameters: 3
- File: wp-includes/ms-functions.php
Related Hooks
Related hooks will be displayed here in future updates.