Check if user is with id or name X

Is there a way to check if a user with a specific id or name is in Wordpress?

+3
source share
2 answers

I think you need a function is_user_logged_in. Maybe try

wp_set_current_user($id, $name = '')

To set the current user by id and then check if they are logged in using

is_user_logged_in()

http://codex.wordpress.org/Function_Reference/wp_set_current_user

http://codex.wordpress.org/Function_Reference/is_user_logged_in

+3
source

jkeesh has a good solution, but may not provide live information. is_user_logged_in()- a conditional statement to perform actions.

, , :

, smiley.jpg

smiley.jpg

, "x " , , . - .

0

Source: https://habr.com/ru/post/1763345/


All Articles