WordPress.org

Codex

Function Reference/get current user id

Contents

Description

Returns the ID of the current user.

Usage

 <?php $user_ID get_current_user_id(); ?> 

Returns

(int) 
The user's ID, if there is a current user; otherwise 0.

Changelog

Since: Version 3.0

Source Code

get_current_user_id() is located in wp-includes/user.php.

Related


See also index of Function Reference and index of Template Tags.