Skip to content

Add Performance Lab generator meta tag to wp_head output #322

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 3 commits into from
May 9, 2022

Conversation

felixarntz
Copy link
Member

Summary

Fixes #321

Relevant technical choices

  • Includes a perflab_get_generator_content() function in addition to the main perflab_render_generator() function that renders the tag. The first function allows to use that information in another way (e.g. WP core supports generators in a variety of variants) and also to test it more appropriately.
  • The perflab_render_generator() function is hooked into wp_head.

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 [Type] Feature A new feature within an existing module Infrastructure Issues for the overall performance plugin infrastructure Needs Review labels May 3, 2022
@felixarntz felixarntz added this to the 1.1.0 milestone May 3, 2022
@felixarntz felixarntz requested a review from jeffpaul May 3, 2022 22:41
@adamsilverstein
Copy link
Member

+1 looks good and support adding this. Since you hooked on head, this would be straightforward to exclude if users want that (remove the hook).

@jeffpaul
Copy link
Member

jeffpaul commented May 4, 2022

We should be rather explicit in the changelog about this as it sounds like it automatically opts a site into this data gathering though I think some details from the related issue help spell out the rationale here (and hopefully anyone who's installed the plugin would be open to the generator tag if that helps prove that certain modules are worth bringing into core).

Copy link
Member

@ThierryA ThierryA left a comment

Choose a reason for hiding this comment

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

LGTM, very supportive of this (to the extent that I believe WP core should provide plugin information automatically without plugins needing to add their own tags 😄 ). Even more so for this plugin specifically since it will enable further measurement which is crucial to validate features which are aimed at being implemented in WordPress core.

Copy link
Contributor

@eugene-manuilov eugene-manuilov left a comment

Choose a reason for hiding this comment

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

LGTM

@felixarntz
Copy link
Member Author

@jeffpaul

We should be rather explicit in the changelog about this as it sounds like it automatically opts a site into this data gathering though I think some details from the related issue help spell out the rationale here (and hopefully anyone who's installed the plugin would be open to the generator tag if that helps prove that certain modules are worth bringing into core).

Definitely, this should be highlighted in the changelog (which it will be given that this PR is marked as a feature). Any data gathering based on this though would be similar to WordPress's own generator tag, which is there by default. But I agree that it needs to be obvious in the changelog.

Copy link
Member

@mitogh mitogh left a comment

Choose a reason for hiding this comment

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

LGTM 🌮

@felixarntz felixarntz changed the title Add Performance Lab generator tag Add Performance Lab generator meta tag May 6, 2022
@felixarntz felixarntz changed the title Add Performance Lab generator meta tag Add Performance Lab generator meta tag to wp_head May 6, 2022
@felixarntz felixarntz changed the title Add Performance Lab generator meta tag to wp_head Add Performance Lab generator meta tag to wp_head output May 6, 2022
@felixarntz felixarntz merged commit 34cf557 into trunk May 9, 2022
@felixarntz felixarntz deleted the add/generator-tag branch May 9, 2022 17:25
@dajana91
Copy link

dajana91 commented Aug 10, 2022

how to remove the unnecessary performance lab generator tag from the meta tags? i don't want to have it in the source code. i also removed the wordpress generator tag via functions.php so that you don't see the wordpress version in the source code. what exactly is the function for functions.php to remove the performance lab meta tag?

I found the solution myself.

Just put the following line in the functions.php:

remove_action('wp_head', 'perflab_render_generator');

And you're rid of the unnecessary entry.

@mxbclang
Copy link
Contributor

@dajana91 Thank you for your feedback here and in your forum post. If we do decide to remove this tag, we will open a separate issue.

@felixarntz
Copy link
Member Author

@dajana91 If you prefer to remove the generator tag, you can do by adding the following code to your site:

remove_action( 'wp_head', 'perflab_render_generator' );

However, note that the generator tag exists to be able to have public performance metrics in HTTP Archive to assess and prove how certain modules of the Performance Lab plugin improve performance, which is important in order to get them eventually merged into WordPress core. By removing the tag, the site will no longer contribute to these.

@dajana91
Copy link

@felixarntz I don't care. I don't want unasked additional information in my source code that doesn't belong there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Type] Feature A new feature within an existing module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add generator tag with plugin version and modules
10 participants