WPTavern: Plugin Dependencies Feature Plugin Now Ready for Testing

For more than a decade, WordPress developers have been discussing how core can support plugins that require one or more other plugins in order to work. Having a standardized way of managing plugin dependencies would be a useful and time-saving feature for developers, who currently have to roll their own solutions for this.

“The situation there is a lot like the relationship between parent and child themes,” project lead Andy Fragen said in February when introducing the idea for the feature plugin. “Without their relationships to the bigger plugin, those dependent plugins can do very little. Every plugin developer is on their own to code a solution to resolve the issue. The single most common example is WooCommerce, which is a dependency for hundreds, if not thousands, of WooCommerce add-on plugins.”

After nine months of discussion and development, the Plugin Dependencies feature plugin is now ready for testing. It allows plugin authors to specify any WordPress.org-hosted plugin(s) that are required for their plugins to function. A plugin that has dependencies can be identified by adding a “Requires Plugins” header to the docblock of the main plugin file. Plugin authors can specify as many dependencies as necessary in a comma-separated list of plugin slugs.

How does it work? Site owners will get an admin notice if there are dependencies they need to install. The plugin card will be updated to display the Requires and Required by information on the Plugins screen.

Fragen outlined how the community can test the new core support for handling plugin dependencies. You do not have to be a developer to participate in testing this new feature. It involves installing test plugin files and confirming admin notices appear and disappear at the right times. Testers who are comfortable editing plugin files can try adding dependencies, adding a dependency for non-WordPress.org plugins, and other more advanced tests.

Version control is not part of this project, so developers will not be able to specify a minimum required version, for example.

“Version control is out of scope for the feature as described in the original Make post referenced above,” Fragen said in response to a question on the feature plugin. “As the majority of the dependencies come from the dot org repository, the most current versions will be installed.

“Specifically, WordPress should automatically prompt the user to update to the current version and may use auto-updates as well.”

Testing will be open until December 1, 2022. Anyone who wants to be part of moving this long-awaited feature towards a possible inclusion in core can report issues to the WP Plugin Dependencies plugin’s repository.

WordPress WordPress Guides