Find out if a user is logged into wordpress from id

后端 未结 1 789
忘掉有多难
忘掉有多难 2021-01-22 14:01

I am looking for a function to check if a user is logged into wordpress via their id.

i am aware of this function.

if ( is_user_logged_in() ) {
    echo          


        
相关标签:
1条回答
  • 2021-01-22 15:04

    you can go around it like:

    if ( is_user_logged_in() ) {
         $current_user = wp_get_current_user();
         if ( 1 == $current_user->ID ) {
          // do staff.
         } else {
           // do staff.
         }
     }
    
    0 讨论(0)
提交回复
热议问题