Pluggable Functions

Pluggable functions were introduced in WordPress 1.5.1 These functions let you override certain core functions via plugins. The most up-to-date list of core functions that WordPress allows plugins to override is available at wp-includes/pluggable.php. WordPress loads the built-in functions only if they are undefined after all plugins have been loaded.

Pluggable functions are no longer being added to WordPress core. All new functions instead use filters on their output to allow for similar overriding of their functionality.

Note: A function can only be reassigned this way once, so you can’t install two plugins that plug the same function for different reasons. For safety, it is best to always wrap your functions with if ( !function_exists() ), otherwise you will produce fatal errors on plugin activation.

Returns true if the specified username and password correspond to a registered user.

auth_redirect()

If a user is not logged in, he or she will be redirected to WordPress' login page before being allowed to access content on the page from which this function was called. Upon successfully logging in, the user is sent back to the page in question.

Example

An example of what you can do with a pluggable function is replace the default email handler. To do this, you'd need to write a plugin that defines a wp_mail() function. The default wp_mail() function looks like this:

Notice that if you plug a core function like this the original is no longer available. I.e., the elegant solution here would have been to write a function that tacks our Cc header on the end of the exising $headers string then call the original wp_mail() with the extra header. However this would not work as the original wp_mail() does not exist if you plug it.