Including pluggable.php within a plugin
-
Hi there,
I’ve been trying to develop a plugin that only initializes its functions if the user is NOT the admin. So to do that I write this:
if (current_user_can('manage_options')) { $is_this_the_admin = true; }
Of course I get the error, “Call to undefined function: wp_get_current_user()” because wp_get_current_user() is not defined yet because it’s a pluggable function. Including pluggable.php is a common workaround that I’ve seen used quite often.
My question is, is it okay to include the pluggable functions within a plugin, like this?
include_once(ABSPATH . 'wp-includes/pluggable.php');
I’ll be using this plugin every day, so I wouldn’t want to create any future problems by including pluggable.php twice.
Thanks a lot!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Including pluggable.php within a plugin’ is closed to new replies.