Title: Including pluggable.php within a plugin
Last modified: August 19, 2016

---

# Including pluggable.php within a plugin

 *  [chrisull](https://wordpress.org/support/users/chrisull/)
 * (@chrisull)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/including-pluggablephp-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)

 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/including-pluggablephp-within-a-plugin/#post-1740978)
 * if you add it to a hook, like init, then you don’t need to do the include.
 *  [Steve](https://wordpress.org/support/users/steveatty/)
 * (@steveatty)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/including-pluggablephp-within-a-plugin/#post-1741224)
 * Oddly enough I’ve had users saying that they still get this error from time to
   time – it seems to happen at random.
 * The way a lot of people are fixing it is to add the include into capabilities.
   php
 *  Thread Starter [chrisull](https://wordpress.org/support/users/chrisull/)
 * (@chrisull)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/including-pluggablephp-within-a-plugin/#post-1741234)
 * Rich, can you explain a bit about using the init hook or share some documentation?
   Many thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Including pluggable.php within a plugin’ is closed to new replies.

 * 3 replies
 * 3 participants
 * Last reply from: [chrisull](https://wordpress.org/support/users/chrisull/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/including-pluggablephp-within-a-plugin/#post-1741234)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
