WordPress.org

Make WordPress Core

#39051 closed defect (bug) (fixed)

docs for get_current_user_id(): add 0 return value if no user logged in

Reported by: ovenall Owned by: johnbillion
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Users Keywords:
Focuses: docs Cc:

Description (last modified by swissspidy)

The docs for get_current_user_id() do not specify that 0 is returned if no user is logged in.
Change to:

/**
 * Get the current user's ID
 *
 * @since MU
 *
 * @return int|0 The current user's ID. Returns 0 if no user is logged in.
 */

Change History (4)

#1 @swissspidy
11 months ago

  • Description modified (diff)

#2 @swissspidy
11 months ago

  • Version trunk deleted

#3 @johnbillion
11 months ago

  • Milestone changed from Awaiting Review to 4.8
  • Owner set to johnbillion
  • Status changed from new to reviewing

#4 @johnbillion
11 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 39486:

Users: Clarify the return value of get_current_user_id() for non-logged-in users.

Props ovenall
Fixes #39051

Note: See TracTickets for help on using tickets.