Random WordPress Function

Learn about a new WordPress function every day!


Function Signature:

grant_super_admin

Function Description:

Grants Super Admin privileges.

Function Examples:

⚠️ Examples below are generated with GPT-3 once every hour. Do not take them too seriously.
Consider them as some extra input in your learning process - reason about them. Will it work? What could fail?
// Example 1: Grant super admin capabilities to a specific user
grant_super_admin( $user_id );

// Example 2: Grant super admin capabilities to a user based on their role
$user = get_user_by( 'login', 'example_user' );
$user_id = $user->ID;
grant_super_admin( $user_id );

// Example 3: Avoid granting super admin capabilities to the current user
$current_user_id = get_current_user_id();
if ( $current_user_id !== $user_id ) {
    grant_super_admin( $user_id );
} else {
    echo "Cannot grant super admin capabilities to the current user.";
}