[wp-trac] [WordPress Trac] #36341: Add a note about the 'init' hook to the DocBlock for get_current_user_id()

WordPress Trac noreply at wordpress.org
Fri Mar 25 23:31:37 UTC 2016


#36341: Add a note about the 'init' hook to the DocBlock for get_current_user_id()
--------------------------+-----------------------------
 Reporter:  DrewAPicture  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Users         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  docs
--------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * component:  Upload => Users


Comment:

 > `Should be used only after the {@see 'init'} action has fired, as the
 current user is not set before that point in the loading order.`

 This seems to contradict comment:19:ticket:14024.

 `get_current_user_id()` calls `wp_get_current_user()`, and while it might
 be uncommon to call it before `init`, it appears to work as expected for
 me on `plugins_loaded`. Is there something I'm missing? :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36341#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list