14th January 2021
Framework / CMS
WordPress [Version: Since 3.0.0]
Get the current logged in user’s ID in WordPress.
Return Value(s)Returns the current user’s ID as an integer, or 0 if no user is logged in.
Examples of get_current_user_id()
<?php $user_id = get_current_user_id();
The above will return the logged in user’s ID as an integer, or 0 if the user is not logged in.
Used In Projects
Was This Helpful?
If this post has helped you, please let me know. Your feedback will be highly appreciated and will help me build better content.