[wp-hackers] What Should A Plugin Author Do To Make Plugins Extensible?

Andrew Nacin wp at andrewnacin.com
Mon Aug 30 04:12:31 UTC 2010


On Sun, Aug 29, 2010 at 11:30 PM, Raj <list at expost.org> wrote:

> What are the best practices to be followed while implementing a plug-in so
> that the plug-in can be extended by other plug-in authors.
>

Here's four to start:

 - Wrap functions in function_exists(). Not necessary for functions attached
to hooks as those can be removed, or those where overriding them makes
little sense (unless you want to be sure there are no conflicts... It's good
practice).

 - Include actions and filters of your own.

 - Make sure you don't execute code on include. This is good practice for
any plugin. Wait for a hook for basically anything.

 - If you're using a class to encapsulate your plugin, make sure you allow
the methods in that plugin to be accessed (singleton, global variable,
etc.), so hooks can be removed and such.


More information about the wp-hackers mailing list