Function: get_current_user_id

get_current_user_id( )

Get the current user's ID

Returns

integer

The current user's ID, or 0 if no user is logged in.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.