current_user_can() in the __construct?
-
When I use current_user_can() in the __construct function in my plugin I’ll get this error: Fatal error: Call to undefined function wp_get_current_user() in C:\Inetpub\WP\wp-includes\capabilities.php on line 969
class myPlugin { public function __construct() { if(current_user_can('manage_options')) add_action("publish_post",array(&$this,'save_post_form')); } }
Is it not possible to run the current_user_can() in the __construct-funktion?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘current_user_can() in the __construct?’ is closed to new replies.