[wp-trac] [WordPress Trac] #43882: Introduce slug-specific hooks to manage plugin loading order
WordPress Trac
noreply at wordpress.org
Fri Apr 27 16:48:35 UTC 2018
#43882: Introduce slug-specific hooks to manage plugin loading order
-------------------------+-----------------------------
Reporter: schlessera | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
As already discussed in #41346, I'd like to propose a simple mechanism
that can solve the loading order problems that inter-dependent plugins can
have.
The main mechanism just adds an action that is named after the plugin that
was just loaded. In this way, other plugins are able to initiate actions
based on when another plugin was loaded.
A similar mechanism has been used in WP-CLI to solve the problems in the
loading order of commands that rely on each other. You can read more about
how commands can control their loading order here:
https://make.wordpress.org/cli/2017/05/03/managing-command-dependencies/
Furthermore, this also allows for a small extension that can automatically
resolve loading order, provided it knows about the dependency to look for.
This is used in WP-CLI as well, where it is easy to deduce the parent
command to look for, as described here:
https://make.wordpress.org/cli/2017/05/31/command-dependencies-revisited/.
For plugins, this could be solved by adding a simple plugin slug to the
plugin header. I'll introduce a separate ticket to that regard.
I will upload a patch that adds the above-mentioned action, together with
`pre_plugin_loaded` and `post_plugin_loaded` actions that give further
control to plugins.
In case anyone wonders whether that might open the door to abuse and have
plugins block loading of other plugins: that is already easily possible
right now. A plugin can just remove whatever plugins it dislikes from the
list of active plugins on activation hook.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43882>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list