[wp-hackers] overriding pluggable.php functions

Stephen Rider wp-hackers at striderweb.com
Sat Jan 10 02:11:18 GMT 2009


It's almost like putting a do_action at the end of every pluggable  
function -- but more powerful and cheaper. :)

Stephen

On Jan 9, 2009, at 2:09 PM, Will Norris wrote:

> I've been thinking about how it would work if pluggable.php were  
> instead made up of functions like:
>
> if (!function_exists('wp_authenticate')) {
>    function wp_authenticate($username, $password) {
>        return _wp_authenticate($username, $password) {
>    }
> }
>
> function _wp_authenticate($username, $password) {
>    /* all the normal authentication logic */
> }
>
> So basically, the functions which can be replaced by plugins don't  
> actually include any logic whatsoever, they simply call "private"  
> counterparts.  This way, I can override wp_authenticate, but can  
> still fall back by calling _wp_authenticate myself.


More information about the wp-hackers mailing list