WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13785 closed defect (bug) (fixed)

Un-deprecate get_current_user_id

Reported by: filosofo Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Users Keywords: has-patch
Focuses: Cc:

Description

There is not a direct, reliable way to access the current user's ID. You either have to get the user object and then the ID property if present, or assume that the $current_user global is populated already (and that's not a reliable assumption).

get_current_user_id is the perfect solution and existed (imperfectly) in MU. Rather than deprecating it, we should move it to general WP and make it use the WP pluggable user functions.

Attachments (1)

non-deprecate-get_current_user_id.13785.diff (1.2 KB) - added by filosofo 4 years ago.

Download all attachments as: .zip

Change History (2)

comment:1 ryan4 years ago

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

(In [15174]) Update get_current_user_id() and move to user.php. Props filosofo. fixes #13785

Note: See TracTickets for help on using tickets.