plugins_loaded action hook and priority
-
Hi,
I noticed this plugin relies heavily on the plugins_loaded action hook. It hooks several callbacks, all with a different priority: -1, 0, 1, 2, 5 and 10. So for a PHP code snippet that is allowed to run everywhere, it looks like it is executed at priority 5 as part of the plugins_loaded action hook.
However some plugins (like Solid Security) initialize on the plugins_loaded action hook with an even higher priority than -1 (eg -90, -100 and -150). A custom PHP code snippet specifically for the Solid Security plugin and implemented with your plugin as is, will thus get executed too late. To fix this, the PHP code snippet needs to be implemented using a MU-plugin (so exit WPCode plugin).
I like your plugin. Don’t like MU-plugins ?? So would it be possible to add a plugin setting named eg plugins_loaded_max_priority (default value -1) which allows to customize the highest priority used by the WPCode plugin on the plugins_loaded action hook ? This would also require an algorithm to calculate the proper priority relative to the new plugins_loaded_max_priority value. As an example, let’s say plugins_loaded_max_priority = -200. The other hooked callbacks then need to be hooked with priority: -199, -198, -197, -194 and -189.
If this enhancement is not feasible, how could such a priority issue be solved (other than using a MU-plugin) ?
Interested to hear your opinion on this matter.
- You must be logged in to reply to this topic.