15 1 0 4000 1 https://codeblock.co.za 300 true 0
theme-sticky-logo-alt

get_current_user_id()

0 Comments

Framework / CMS

WordPress [Version: Since 3.0.0]

Syntax

Typical Usage

Get the current logged in  user’s ID in WordPress.

Accepted Parameters

None

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()

Example 1

<?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.

Was This Helpful?

Next Post
get_user_meta()

0 Comments

Leave a Reply