add_user_role WordPress Action Hook

This hook is used to add a user role to a WordPress site. It is called when a user is created or when their role is changed. It takes two arguments: the user ID and the role to add.

do_action( 'add_user_role', int $user_id, string $role ) #

Fires immediately after the user has been given a new role.


Parameters

$user_id

(int)The user ID.

$role

(string)The new role.


Top ↑

Source

File: wp-includes/class-wp-user.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.