How to Replace a WordPress Function

This is mainly for my own records, but the curious thing is that when I do a simple search for “how to replace a wordpress function” or a few derivatives of that phrase I’m usuually returned the following links (at least w/ Google):

However, what I’m really looking to do is basically swap in one of my own functions for a WordPress Core Function. It seems that WordPress’ Pluggable Functions allows me to do that:

The explain it a bit here:

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.

Now, this only allows you to replace a limited number of WordPress functions, but it does, what it says it does, and that is to allow you to replace a core WordPress function by using WordPress’ Pluggable Functions.

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

Leave a Reply