Check for fetchpriority feature being available in WordPress core before loading the module #769
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR checks for existence of the fetchpriority feature in WordPress core, which was merged earlier this week and will become widely available with the WordPress 6.3 launch in August (see https://core.trac.wordpress.org/ticket/58235). We should therefore ensure before that release that Performance Lab caters for that situation.
Relevant technical choices
can-load.php
file is added, the default mechanism to check whether a module can be loaded, with the closure returningfalse
when the WP core version on the site already provides the feature.can-load.php
file is irrelevant, therefore the PR adds an admin notice closure which is only shown for the standalone plugin (based on the specific constant check).readme.txt
has been updated and the standalone plugin version is bumped to 1.1.0. This will automatically be published together with the next Performance Lab plugin release on July 17.Screenshots
Performance Lab module checkbox when feature already in core

Admin notice for standalone plugin when feature already in core

Checklist
[Focus]
orInfrastructure
label.[Type]
label.no milestone
label.