[wp-hackers] plugin loading order (rfc)
Peter Westwood
peter.westwood at ftwr.co.uk
Sun Mar 11 22:19:15 GMT 2007
Jennifer Hodgdon wrote:
>
>> Could you expand this issue / or link to an example of the problem.
>>
>> I'm not sure how allowing control over the include order of plugins
>> gives people any benifit apart from wining in the pluggable function
>> definition battle.
>
> I can think of one possible use. A plugin I use makes a multi-lingual
> blog, in part by having the locale of WordPress be dynamic. During the
> load, so that it happens as early as possible, the plugin figures out
> what language the user wants to view the blog in, and then sets the
> WordPress locale.
>
> The problem is that other plugins could call load_plugin_text_domain
> during their load phase (to load their internationalization). So if they
> are loaded before the multilingual plugin, they will have loaded the
> wrong locale. Maybe there is some way to reset their text domain to the
> right locale, but I can't figure out a very smart way to do it. So
> ensuring that the multilingual plugin loads first would be good.
>
> Or, ensuring that the plugins wait until later to call
> load_plugin_text_domain, but that is up to the plugin author...
>
If all plugins were written to do there initialisation on the init hook
(which they should be but a lot are not!) then this should be as simple
as adding you action to init with the highest priority and then you will
get called first.
Alternatively we could have a special multi-lingual blog hook done in a
similar way to the caching hook that can only be definition be provided
by a single solution.
westi
--
Peter Westwood
http://blog.ftwr.co.uk
More information about the wp-hackers
mailing list