wp-cli / extension-command

Manages plugins and themes, including installs, activations, and updates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin Dependencies Support

Luc45 opened this issue · comments

Feature Request

WordPress 6.5 adds the Plugin Dependencies capability. It would be useful if plugin install had a --with-dependencies flag to also install the dependencies of the plugin being installed.

Generally speaking, we need to test with the new plugin dependencies feature and see if and what to change. If the plugin‘s API provides this information easily, then I could see such a flag being useful for sure.

I haven't looked at how WP Core does it, but it should probably be surfaced on the API already to render it on the wp-admin?plugins.php page

Right. This is surfaced in the API via the requires_plugins field which contains an array of slugs.

Example: https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wpsso-wc-metadata&fields=versions

So should be available for us too 👍

Edit:

for already installed plugins we might be able to use the WP_Plugin_Dependencies class

One use case I just stumbled upon:

Provide an easy way to install all dependencies of a plugin.

e.g. if I have plugin X installed (not necessarily activated) that depends on Y and Z, I want an easy way to install Y and Z, without having to activate X.

Listing dependencies in wp plugin get <slug> would also be useful