Skip to content

Check for fetchpriority feature being available in WordPress core before loading the module #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

felixarntz
Copy link
Member

@felixarntz felixarntz commented Jun 28, 2023

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

  • For the module, a can-load.php file is added, the default mechanism to check whether a module can be loaded, with the closure returning false when the WP core version on the site already provides the feature.
  • For the standalone plugin version of the module, the 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).
  • The standalone plugin's 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
Screenshot 2023-06-28 at 10 54 13 AM

Admin notice for standalone plugin when feature already in core
Screenshot 2023-06-28 at 11 03 17 AM

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@felixarntz felixarntz added this to the PL Plugin 2.5.0 milestone Jun 28, 2023
@felixarntz felixarntz added [Type] Enhancement A suggestion for improvement of an existing feature [Focus] Images labels Jun 28, 2023
Copy link
Member

@kt-12 kt-12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @felixarntz. LGTM!.

Just an observation, since we are not forcefully disabling fetchpriority for standalone plugin, there can be a chance of having 2 fetchpriority in a page - If the post thumbnail is less than the 50000px threshold, but one of the first 3 content image is larger than the threshold ( a very rare edge case )

@felixarntz
Copy link
Member Author

@kt-12 Fair point, thanks for raising. I think that's okay though, also given that the standalone plugin currently only has 20+ installs.

Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @felixarntz for the PR, Look good to me.

@mukeshpanchal27 mukeshpanchal27 merged commit dda9253 into trunk Jul 3, 2023
@mukeshpanchal27 mukeshpanchal27 deleted the add/fetchpriority-wp63-compat branch July 3, 2023 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants