Ticket #13785 (closed defect (bug): fixed)

Opened 2 years ago

Last modified 2 years ago

Un-deprecate get_current_user_id

Reported by: filosofo Owned by:
Priority: normal Milestone: 3.0
Component: Users Version: 3.0
Severity: normal Keywords: has-patch
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

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

Change History

comment:1   ryan2 years ago

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

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

Note: See TracTickets for help on using tickets.