This page redirects to an external site: https://developer.wordpress.org/reference/functions/get_current_user_id/
Languages: English • Italiano • (Add your language)
Returns the ID of the current user.
Use the init or any subsequent action to call this function. Calling it outside of an action can lead to troubles.
<code style="color: #000000"> <span style="color: #0000BB"><?php $user_ID </span><span style="color: #007700">= </span><span style="color: #0000BB">get_current_user_id</span><span style="color: #007700">(); </span><span style="color: #0000BB">?></span> </code>
Since: Version 3.0
get_current_user_id() is located in wp-includes/user.php.
Get User Functions:
Current User Functions: get_current_user_id(), get_currentuserinfo(), wp_get_current_user(), wp_set_current_user(), current_user_can(), current_user_can_for_blog()