Support » Plugins » Including pluggable.php

  • On another board someone is telling me that using a require_once on pluggable.php at the top of my plugin code is “bad practice” because it means that others cannot then override functions defined inside pluggable.php, and that what I should do is copy the functions in pluggable.php to another file which basically has a set of function_exists wrappers wrapped round the existing pluggable functions.

    Which would seem to put a big onus on me to maintain a copy of pluggable.php.

    If I don’t include it then my code fails because it cant find wp_get_current_user()

    So is this really true or is this someone trying to fix a problem in their code by saying I should change mine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You should not include any core files into your plugins. You don’t need to. If you are creating a plugin or adding code to your theme’s functions.php, which are the only two ways to correctly add custom php functions to WordPress, then you will indeed already have access to all of WordPress’s functions.

    The pluggable functions are meant to be re-defined by your code, which is the reason they are wrapped in function_exists statements.


    I have put my functions in custom_functions.php folder of the Headway theme I am using but I get a “call to undefined function” when I try to use wp_update_user() in one of those functions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Including pluggable.php’ is closed to new replies.