Answers for "set user as admin wp"

PHP
2

wp is user admin

if ( current_user_can('administrator') ) {} // also others than admin w same capabilities
if ( is_user_admin() ){} // if it is admin
if ( is_admin() ){} //if the view is not the admin interface but the theme
Posted by: Guest on June-04-2021
0

wp_create_user

function wp_create_user( $username, $password, $email = '' ) {
    $user_login = wp_slash( $username );
    $user_email = wp_slash( $email );
    $user_pass  = $password;
 
    $userdata = compact( 'user_login', 'user_email', 'user_pass' );
    return wp_insert_user( $userdata );
}
Posted by: Guest on September-01-2021

Browse Popular Code Answers by Language