Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Call get_currentuserinfo(); after declaring the global to populate the properties. Perhaps you’ve already done this elsewhere, go ahead and do it again for the sake of trying something. You might also try checking the ID value instead of login.

    Sometimes using !== will make a difference, you might try that as well.

    Thread Starter mme

    (@mme)

    Thanks for the reply, after some further testing it was still not working for me.

    So I tried with the code below and it is all working now

    if (!function_exists('wp_get_current_user')) {require_once(ABSPATH.'wp-includes/pluggable.php');}
    
    $current_user=wp_get_current_user();
    if($current_user->ID!==1)
    {
      //Do stuff here
    }
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hiding Elements for other admins’ is closed to new replies.