[wp-hackers] Make a function available to other plugins
Dion Hulse (dd32)
wordpress at dd32.id.au
Wed Aug 10 11:18:36 UTC 2011
Put simply: No plugin should execute any logic upon being included.
The only real functions you should ever need to call are: add_action,
add_filter, and register_*_hook.
All code can usually be executed on the init hook, which is the
earliest you can expect WordPress (and plugins) to be loaded and ready
for action..
If you need to run code which is going to affect how WordPress loads,
the plugins_loaded hook can be useful.
If you need to run code which relies upon another plugins code running
first, and they're behaving themselves, running your code LATE on the
init hook should allow your plugin to run after the other plugin has
run.
On 10 August 2011 21:12, Alex Hempton-Smith <hempsworth at gmail.com> wrote:
> I'm developing a plugin that other plugins can integrate with, they will
> need access to a function within my plugin. Obviously, if their plugin is
> loaded before mine, it will result in an error. How do I ensure that my
> plugin will be loaded first?
>
> Likewise, if I want to build in some compatibility with another plugin
> (BuddyPress), how do I make sure that is loaded before mine?
>
> I could use 'plugins_loaded' with a high priority, but that doesn't seem
> very foolproof to me?
>
> - - - -
> Kind regards,
> Alex Hempton-Smith
>
> www.alexhemptonsmith.com
> www.twitter.com/hempsworth
> _______________________________________________
> 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