Add Yoast tab to Plugins screen using WP 7.0 filters#23101
Conversation
Registers `plugins_list` and `plugins_list_status_text` filters to group all Yoast-authored plugins under a dedicated "Yoast" tab on the WordPress Plugins admin screen. Plugins are detected dynamically by checking for "Team Yoast" in the AuthorName header. The tab only appears when 2+ Yoast plugins are installed and requires WP 7.0+. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Compare against 7.0-alpha0 instead of 7.0 so that beta and RC releases also pass the version guard. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Pull Request Test Coverage Report for Build 1e8db9f9c41eeb8ef2fb677084083cb037b9c919Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
thijsoo
left a comment
There was a problem hiding this comment.
Some suggestions and an overal comment is that I think you should get rid of the Yoast_ prefix on all the classes+tests and I also think you can get rid of it in the folder structure and namespace since its a bit redundant since we are in the context of our codebase and this is not an external API just a couple of filters.
| * | ||
| * @return array<string, array<string, array<string, string>>> The filtered plugins list. | ||
| */ | ||
| public function filter_plugins_list( array $plugins ): array { |
There was a problem hiding this comment.
We need to get rid of the type hints here since this is fed by a filter.
| * | ||
| * @return string The status text. | ||
| */ | ||
| public function get_status_text( string $text, int $count, string $type ): string { |
There was a problem hiding this comment.
We need to get rid of the type hints here since this is fed by a filter.
Address PR review feedback: - Rename src/yoast-plugins-tab/ to src/plugins-tab/ and drop the Yoast_ prefix from all class names and namespaces since it is redundant within the Yoast codebase context. - Remove parameter type hints from filter_plugins_list() and get_status_text() since they are called by WordPress filters which may pass unexpected types. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
makes total sense, on it |
Context
WordPress 7.0 adds a
plugins_list_status_textfilter (core #60495) that allows plugins to register custom tabs on the Plugins screen. Combined with the existingplugins_listfilter, this enables grouping plugins under a custom tab with a proper label. A dedicated "Yoast" tab on the Plugins screen groups all Yoast plugins in one view, making it easier for site admins to check versions, manage activation, and get an overview of their Yoast suite.Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
AuthorNameheader, rather than hardcoding a list of slugs. This is future-proof and covers all Yoast plugins (free, premium, addons, Duplicate Post, ACF Analysis, Test Helper, etc.).src/yoast-plugins-tab/with domain, application, and user-interface layers.7.0-alpha0(not7.0) to support pre-release versions (beta, RC).Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation
Fixes https://github.com/Yoast/reserved-tasks/issues/1128