Support » Plugin: Private Content » How do I find the User ID of the logged in User

Viewing 1 replies (of 1 total)
  • Plugin Author aldolat

    (@aldolat)

    Hi,
    you can get the current user’s ID using:

    <?php $my_user = get_current_user_id(); ?>

    Now $my_user contains the userID.

    Another way is to use the $current_user global variable in this way:

    <?php global $current_user;
    $my_user = $current_user->ID; ?>

    Bye.

Viewing 1 replies (of 1 total)
  • The topic ‘How do I find the User ID of the logged in User’ is closed to new replies.