Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#60472 closed defect (bug) (fixed)

Improve the `plugin_missing_dependencies` error message

Reported by: desrosj's profile desrosj Owned by: costdev's profile costdev
Milestone: 6.5 Priority: normal
Severity: minor Version: 6.5
Component: Plugins Keywords: has-patch
Focuses: Cc:


Follow up to #22316/[57545].

In validate_plugin_requirements(), a new error message was added that is displayed in certain scenarios when plugin dependencies are unmet.

<strong>Error:</strong> %s requires plugins that are not installed or activated.

There's no clear call to action here. At a minimum there should be a link to the Plugins page.

I think the wording could also be improved. Here are a few suggestions:

  • %s has unmet requirements and cannot be activated.
  • %s requires the following plugins to be active: %%list of plugins%%
  • %s cannot be activated unless the following plugins are installed and activated: %%list of plugins%%

Attachments (1)

Screenshot 2024-02-10 at 10.07.00 PM.png (45.5 KB) - added by huzaifaalmesbah 5 months ago.
after apply patch

Download all attachments as: .zip

Change History (15)

#1 @knutsp
5 months ago


Singular: %s cannot be activated unless this plugin are installed and active: %%plugin%%
Plural: %s cannot be activated unless the following plugins are installed and active: %%list of plugins%%

active/inactive: Adjective, Current state of a plugin
activating/deactivating: Inflected verbs, The action of changing a plugin's state

Version 1, edited 5 months ago by knutsp (previous) (next) (diff)

#2 in reply to: ↑ description @knutsp
5 months ago


Last edited 5 months ago by knutsp (previous) (diff)

This ticket was mentioned in PR #6074 on WordPress/wordpress-develop by @costdev.

5 months ago

  • Keywords has-patch added

Previously, the message returned when validate_plugin_requirements() detects unmet plugin dependencies was not clear for users and did not detail the dependencies that were not installed and active.

This adds extra information to the error message to list the name(s) of the plugin(s) that need to be installed and activated.

Note: If the plugin is not installed and its name cannot be retrieved from the Plugins Repository, its slug will be displayed.

This PR does not add direction as this error message is only displayed

### Before

#### Dashboard (added as a notice via DevTools for illustration)

#### WP-CLI

### After
### Dashboard (added as a notice via DevTools for illustration)

### WP-CLI

Note: WP-CLI strips HTML from the message, so the link doesn't appear. This is also why there is no period at the end of the error message, after the link.

#4 @costdev
5 months ago

  • Keywords needs-testing added
  • Version set to trunk

PR 6074 updates the message to include a list of dependency names, or their slug if not available, as well as a link to the plugins page.

Note: WP-CLI strips HTML from the message, so the link to the plugins page will not be displayed there. The link is not followed by a period because the result would be:

Warning: Failed to activate plugin. WooCommerce requires the following plugin(s) to be installed and activated: Hello Dolly, Addon for Hello Dolly. .

Note the trailing period.

Please test 🙂

@afragen commented on PR #6074:

5 months ago

Tested in CLI and works.

#6 @costdev
5 months ago

  • Owner set to costdev
  • Status changed from new to assigned

@huzaifaalmesbah commented on PR #6074:

5 months ago

I tested, error message looks good now.

@costdev commented on PR #6074:

5 months ago

@desrosj Also, I'm thinking through this scenario from a multisite perspective. Could there be a scenario where a plugin is missing dependencies but the user is unable to install or activate the required plugins (not a network administrator)?

Good question!

Brain-dumping as I think this through:

  • Assuming there are no custom roles, Super admins are the only ones who can install or delete plugins in a multisite.
  • Again, assuming no additional capabilities have been granted, Site admins can only activate or deactivate the plugins for their site.
  • If a network doesn't have *Dependency A* installed, then the Site admin will need to contact the Super admin to install it.
  • If the Site admin visits the Plugins > Installed plugins page, they won't see an Add New Plugin button, and there doesn't seem to be any existing Core notice or information on that page to let them know that plugins can only be installed by contacting the Super admin.
    • This is maybe where we could introduce some messaging, even just a simple paragraph above the list table. I think it might be better that this is done outside the Plugin Dependencies context so that it's available information for Site admins all the time.
  • Plugins are located in the root site's wp-content/plugins directory, which presumably a Site admin won't have access to via FTP/SSH if they aren't allowed to do it through the Dashboard, so the Site admin shouldn't encounter the scenario you described through this path.
  • The Super admin won't be able to install a dependent that has unmet dependencies, and won't be able to update a dependent to a new version that has new, unmet dependencies, so the Site admin shouldn't encounter the scenario you described through this path.
  • Some plugins provide an "Our addons" page in their menu with the ability to install and activate them, or add a new tab to Plugins > Add New. Whether they check the current user's capabilities, or perform their own download+extract+move+activate routine is at their discretion.

#9 @swissspidy
5 months ago

@desrosj @costdev Just checking in here, is this on the radar still for 6.5, maybe even for tomorrow's beta?

#10 @costdev
5 months ago

@swissspidy Yes this is still on the radar for 6.5, but may not be reviewed and approved in time for Beta 3.

#11 @costdev
5 months ago

  • Keywords needs-testing removed

6.5 RC1 is being released today and the String Freeze comes into effect. We need final reviews and commit of PR 6074 ahead of this.

@desrosj @swissspidy It's currently nearing 3am for me. If either/both of you get a chance, would you mind making any final adjustments to PR 6074 and committing for RC1?

This ticket was mentioned in Slack in #core by desrosj. View the logs.

5 months ago

#13 @desrosj
5 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.