Action hook 'grant_super_admin'

in WP Core File wp-includes/capabilities.php at line 1203

View Source

grant_super_admin

Action Hook
Description
Fires before the user is granted Super Admin privileges.

Hook Information

File Location wp-includes/capabilities.php View on GitHub
Hook Type Action
Line Number 1203

Hook Parameters

Type Name Description
int $user_id ID of the user that is about to be granted Super Admin privileges.

Usage Examples

Basic Usage
<?php
// Hook into grant_super_admin
add_action('grant_super_admin', 'my_custom_function', 10, 1);

function my_custom_function($user_id) {
    // Your custom code here
}

Source Code Context

wp-includes/capabilities.php:1203 - How this hook is used in WordPress core
<?php
1198  	 *
1199  	 * @since 3.0.0
1200  	 *
1201  	 * @param int $user_id ID of the user that is about to be granted Super Admin privileges.
1202  	 */
1203  	do_action( 'grant_super_admin', $user_id );
1204  
1205  	// Directly fetch site_admins instead of using get_super_admins().
1206  	$super_admins = get_site_option( 'site_admins', array( 'admin' ) );
1207  
1208  	$user = get_userdata( $user_id );

PHP Documentation

<?php
/**
	 * Fires before the user is granted Super Admin privileges.
	 *
	 * @since 3.0.0
	 *
	 * @param int $user_id ID of the user that is about to be granted Super Admin privileges.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/capabilities.php
Related Hooks

Related hooks will be displayed here in future updates.