i have a custom theme with frontend E-Mail and Facebook login. Every user gets the author role by default after registration.
How can i echo the USERS ID in the frontend wich shows up by hovering about the users name in the backend? I tried this:
<?php echo the_author_ID(); ?>
But it does not works for the admin role and Users who logged in with facebook? The id shows up with hovering in the backend… Any idea?
Update: i will show the IDs of the users who are registered – in their frontend author.php AND not the ID of the current user who is logged in!
It is specific only to users with
user_role=author
If you want admin roles and users from facebook login you can tryget_current_user_id()
It looks like you are looking for this,
The
function has been deprecated.
You can use
get_current_user_id()
.Returns the ID of the current viewer if they are logged in. Returns 0 if the viewer is not logged in. you can try for current user like this :You can also try
current user object (WP_User)
.Retrieve the current user object (WP_User).