[wp-trac] [WordPress Trac] #61161: current_user_can fatal error

WordPress Trac noreply at wordpress.org
Tue May 7 11:30:52 UTC 2024


#61161: current_user_can fatal error
-----------------------------+------------------------------
 Reporter:  kkmuffme         |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Role/Capability  |     Version:  trunk
 Severity:  major            |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by siliconforks):

 Note that it has always been documented that the earliest you can access
 the current user is in the `init` action.

 https://developer.wordpress.org/apis/hooks/action-reference/#actions-run-
 during-a-typical-request

 So I would not expect it to work before `init`.  (But it might make more
 sense to display a useful error message instead of crashing due to a
 missing function.)

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


More information about the wp-trac mailing list