WordPress.org

Ready to get started?Download WordPress

Forums

Including pluggable.php (3 posts)

  1. Steve
    Member
    Posted 4 years ago #

    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.

  2. Eric Marden
    Member
    Posted 3 years ago #

    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.

  3. Philip Hesketh
    Member
    Posted 3 years ago #

    xenlab,

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic