[wp-hackers] pluggable.php

Ben Lobaugh lists at lobaugh.net
Fri Aug 31 18:08:30 UTC 2012


There are lots of reasons to stay away from pluggable function. The most 
glaring is the fact that plugin authors can easily cause the site to 
blow up with fatal errors. The way pluggable works is that the core 
checks to see if that function already exists. If it does in your plugin 
then the core version does not load. Sounds cool but what about

- Your plugin overrrides wp_mail, plugin X also overrides wp_mail. You 
install both, your site dies
- Your plugin overrides wp_mail but you are polite enough to ensure that 
nothing else has overridden wp_mail. Now plugin X owns wp_mail and your 
plugin's functionality now no longer works, potentially blowing up the 
site still

See? Don't make pluggable functions. Use hooks. Hooks can be tapped into 
unlimited times to alter whatever needs altering by your plugin

On 8/31/12 10:30 AM, John wrote:
> What are the reasons for this? Just curious if there are technical reasons
> or what.
>
>
> On Fri, Aug 31, 2012 at 12:12 PM, Jeremy Clarke <jer at simianuprising.com>wrote:
>
>> I.e. The whole concept of pluggable functions is legacy. If
>> reverse-compatibility wasn't an issue they'd all be removed.
>>
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list