• Resolved hupe13

    (@hupe13)


    Is there a way to say, “Plugin A depends on Plugin B or C”? In other words, either Plugin B or Plugin C (or both) must be activated in order to use Plugin A?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator threadi

    (@threadi)

    Requires Plugins: A comma-separated list of WordPress.org-formatted slugs for its dependencies, such as my-plugin (my-plugin/my-plugin.php is not supported). It does not support commas in plugin slugs. For more info read the related dev note.

    https://developer.wordpress.org/plugins/plugin-basics/header-requirements/

    So I don’t think this can be linked using “OR”. These are “AND” conditions. For example, take a look at how this data is analyzed here: https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/plugin-install.php#L910

    To achieve your goal, I would skip this condition and move the check into the plugin. If either of the two plugins is missing, suspend the service and display a warning somewhere.

    Thread Starter hupe13

    (@hupe13)

    Okay. Thank you.

    Tecnología Geek

    (@yasminmultiservice809)

    Not with the built-in system. The “Requires Plugins” header added in WordPress 6.5 only supports AND — every plugin listed has to be active. For an either/or like yours you have to roll it yourself: hook into admin_init or plugins_loaded, check is_plugin_active() for B and for C, and if neither is active, show an admin notice and stop Plugin A from running (or deactivate it). It’s a short check, but there’s no core syntax for OR dependencies.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.