[wp-hackers] overriding pluggable.php functions
Dougal Campbell
dougal at gunters.org
Sat Jan 10 22:43:11 GMT 2009
Will Norris wrote:
> I actually chatted with Peter Westwood in #wordpress-dev today and he
> suggested using filters instead... there is certainly an elegance to
> this. pluggable.php was designed to *replace* functionality, not
> *add* it. There is already a great mechanism in wordpress to add
> functionality... filters and actions. So imagine something along the
> lines of... [...example using filters...]
At first I thought this was just adding a couple of extra layers of
function calls without any real advantage. But then I realized that this
approach avoids a major pitfall of the existing method and the
previously suggested enhancement: function namespace collisions.
Currently, if you have two different plugins trying to replace the same
pluggable function, they can trigger a PHP fatal error unless the
plugins are *also* using function_exists() as a safety net.
Good evolution of a good idea. :)
--
Dougal Campbell <dougal at gunters.org <mailto:dougal at gunters.org>>
http://dougal.gunters.org/
http://twitter.com/dougal
More information about the wp-hackers
mailing list