WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#16363 closed defect (bug) (invalid)

current_user_can()

Reported by: merianos Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.4
Component: Users Keywords:
Focuses: Cc:

Description

I use the function current_user_can() and then I get the error

Fatal error: Call to undefined function wp_get_current_user() in D:\VirtualHost\www.wordpress3.dch\www\wp-content\plugins\my_plugin\includes\init.php on line 5

the function is used into a plugin of mine.

Change History (1)

comment:1 @nacin5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

You're using it too early.

You need to wait until the current user is set up, which means about the init hook.

For more, try the support forums: http://wordpress.org/support/.

Note: See TracTickets for help on using tickets.