diff --git a/load.php b/load.php
index acf35531fd..3224969c8b 100644
--- a/load.php
+++ b/load.php
@@ -57,7 +57,8 @@ function perflab_get_generator_content() {
}
return sprintf(
- 'Performance Lab %1$s; plugins: %2$s',
+ // Use the plugin slug as it is immutable.
+ 'performance-lab %1$s; plugins: %2$s',
PERFLAB_VERSION,
implode( ', ', $active_plugins )
);
diff --git a/plugins/dominant-color-images/hooks.php b/plugins/dominant-color-images/hooks.php
index 29e0d541bf..9c2b1f7d97 100644
--- a/plugins/dominant-color-images/hooks.php
+++ b/plugins/dominant-color-images/hooks.php
@@ -178,6 +178,7 @@ function dominant_color_add_inline_style() {
* @since 1.0.0
*/
function dominant_color_render_generator() {
- echo '' . "\n";
+ // Use the plugin slug as it is immutable.
+ echo '' . "\n";
}
add_action( 'wp_head', 'dominant_color_render_generator' );
diff --git a/plugins/dominant-color-images/readme.txt b/plugins/dominant-color-images/readme.txt
index bbc2dde01a..c3092a12c0 100644
--- a/plugins/dominant-color-images/readme.txt
+++ b/plugins/dominant-color-images/readme.txt
@@ -52,6 +52,7 @@ Contributions are always welcome! Learn more about how to get involved in the [C
= 1.1.0 =
* Rename plugin to "Image Placeholders". ([1101](https://github.com/WordPress/performance/pull/1101))
+* Use plugin slug for generator tag. ([1103](https://github.com/WordPress/performance/pull/1103))
* Bump minimum required WP version to 6.4. ([1062](https://github.com/WordPress/performance/pull/1062))
* Update tested WordPress version to 6.5. ([1027](https://github.com/WordPress/performance/pull/1027))
diff --git a/plugins/embed-optimizer/hooks.php b/plugins/embed-optimizer/hooks.php
index 6f797cf795..a587c4de16 100644
--- a/plugins/embed-optimizer/hooks.php
+++ b/plugins/embed-optimizer/hooks.php
@@ -162,6 +162,7 @@ function embed_optimizer_trigger_error( string $function_name, string $message,
* @since 0.1.0
*/
function embed_optimizer_render_generator() {
- echo '' . "\n";
+ // Use the plugin slug as it is immutable.
+ echo '' . "\n";
}
add_action( 'wp_head', 'embed_optimizer_render_generator' );
diff --git a/plugins/embed-optimizer/readme.txt b/plugins/embed-optimizer/readme.txt
index 0e54f7393a..be16765df4 100644
--- a/plugins/embed-optimizer/readme.txt
+++ b/plugins/embed-optimizer/readme.txt
@@ -51,6 +51,7 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu
= 0.1.1 =
+* Use plugin slug for generator tag. ([1103](https://github.com/WordPress/performance/pull/1103))
* Bump minimum required WP version to 6.4. ([1076](https://github.com/WordPress/performance/pull/1076))
= 0.1.0 =
diff --git a/plugins/optimization-detective/helper.php b/plugins/optimization-detective/helper.php
index 589baaf2e2..6a69becd3d 100644
--- a/plugins/optimization-detective/helper.php
+++ b/plugins/optimization-detective/helper.php
@@ -18,5 +18,6 @@
* @since 0.1.0
*/
function od_render_generator_meta_tag() {
- echo '' . "\n";
+ // Use the plugin slug as it is immutable.
+ echo '' . "\n";
}
diff --git a/plugins/optimization-detective/load.php b/plugins/optimization-detective/load.php
index b448a0027b..25c7d19841 100644
--- a/plugins/optimization-detective/load.php
+++ b/plugins/optimization-detective/load.php
@@ -5,7 +5,7 @@
* Description: Uses real user metrics to improve heuristics WordPress applies on the frontend to improve image loading priority.
* Requires at least: 6.4
* Requires PHP: 7.0
- * Version: 0.1.0
+ * Version: 0.1.1
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
@@ -43,7 +43,7 @@
);
}
-define( 'OPTIMIZATION_DETECTIVE_VERSION', '0.1.0' );
+define( 'OPTIMIZATION_DETECTIVE_VERSION', '0.1.1' );
require_once __DIR__ . '/helper.php';
diff --git a/plugins/optimization-detective/readme.txt b/plugins/optimization-detective/readme.txt
index 6fc33da6d6..a18f4a72b6 100644
--- a/plugins/optimization-detective/readme.txt
+++ b/plugins/optimization-detective/readme.txt
@@ -4,7 +4,7 @@ Contributors: wordpressdotorg
Requires at least: 6.4
Tested up to: 6.5
Requires PHP: 7.0
-Stable tag: 0.1.0
+Stable tag: 0.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, images
@@ -137,6 +137,10 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu
== Changelog ==
+= 0.1.1 =
+
+* Use plugin slug for generator tag. ([1103](https://github.com/WordPress/performance/pull/1103))
+
= 0.1.0 =
* Initial release.
diff --git a/plugins/speculation-rules/hooks.php b/plugins/speculation-rules/hooks.php
index d1dde3896f..7cc98a3639 100644
--- a/plugins/speculation-rules/hooks.php
+++ b/plugins/speculation-rules/hooks.php
@@ -54,6 +54,7 @@ function plsr_print_speculation_rules() {
* @since 1.1.0
*/
function plsr_render_generator_meta_tag() {
- echo '' . "\n";
+ // Use the plugin slug as it is immutable.
+ echo '' . "\n";
}
add_action( 'wp_head', 'plsr_render_generator_meta_tag' );
diff --git a/plugins/webp-uploads/hooks.php b/plugins/webp-uploads/hooks.php
index 677cd0d20f..ec5e318f0b 100644
--- a/plugins/webp-uploads/hooks.php
+++ b/plugins/webp-uploads/hooks.php
@@ -770,7 +770,8 @@ function webp_uploads_modify_webp_quality( $quality, $mime_type ) {
* @since 1.0.0
*/
function webp_uploads_render_generator() {
- echo '' . "\n";
+ // Use the plugin slug as it is immutable.
+ echo '' . "\n";
}
add_action( 'wp_head', 'webp_uploads_render_generator' );
diff --git a/plugins/webp-uploads/readme.txt b/plugins/webp-uploads/readme.txt
index 806b2b015d..b80cd46af1 100644
--- a/plugins/webp-uploads/readme.txt
+++ b/plugins/webp-uploads/readme.txt
@@ -64,6 +64,7 @@ By default, the Modern Image Formats plugin will only generate WebP versions of
* Add link to WebP settings to plugins table. ([1036](https://github.com/WordPress/performance/pull/1036))
* Rename plugin to "Modern Image Formats". ([1101](https://github.com/WordPress/performance/pull/1101))
+* Use plugin slug for generator tag. ([1103](https://github.com/WordPress/performance/pull/1103))
* Bump minimum required WP version to 6.4. ([1062](https://github.com/WordPress/performance/pull/1062))
* Update tested WordPress version to 6.5. ([1027](https://github.com/WordPress/performance/pull/1027))
diff --git a/tests/load-tests.php b/tests/load-tests.php
index e31e16c1a4..55a1865bcf 100644
--- a/tests/load-tests.php
+++ b/tests/load-tests.php
@@ -8,13 +8,13 @@
class Load_Tests extends WP_UnitTestCase {
public function test_perflab_get_generator_content() {
- $expected = 'Performance Lab ' . PERFLAB_VERSION . '; plugins: ';
+ $expected = 'performance-lab ' . PERFLAB_VERSION . '; plugins: ';
$content = perflab_get_generator_content();
$this->assertSame( $expected, $content );
}
public function test_perflab_render_generator() {
- $expected = '' . "\n";
+ $expected = '' . "\n";
$output = get_echo( 'perflab_render_generator' );
$this->assertSame( $expected, $output );
diff --git a/tests/plugins/dominant-color-images/dominant-color-test.php b/tests/plugins/dominant-color-images/dominant-color-test.php
index 04e8caba46..a2b032a892 100644
--- a/tests/plugins/dominant-color-images/dominant-color-test.php
+++ b/tests/plugins/dominant-color-images/dominant-color-test.php
@@ -371,4 +371,16 @@ public function provider_get_hex_color() {
),
);
}
+
+ /**
+ * Test printing the meta generator tag.
+ *
+ * @covers ::dominant_color_render_generator
+ */
+ public function test_dominant_color_render_generator() {
+ $tag = get_echo( 'dominant_color_render_generator' );
+ $this->assertStringStartsWith( 'assertStringContainsString( 'generator', $tag );
+ $this->assertStringContainsString( 'dominant-color-images ' . DOMINANT_COLOR_IMAGES_VERSION, $tag );
+ }
}
diff --git a/tests/plugins/embed-optimizer/embed-optimizer-test.php b/tests/plugins/embed-optimizer/embed-optimizer-test.php
index 6dfca002a3..ccca9dff28 100644
--- a/tests/plugins/embed-optimizer/embed-optimizer-test.php
+++ b/tests/plugins/embed-optimizer/embed-optimizer-test.php
@@ -7,6 +7,11 @@
class Embed_Optimizer_Helper_Tests extends WP_UnitTestCase {
+ public function test_hooks() {
+ $this->assertSame( 10, has_filter( 'embed_oembed_html', 'embed_optimizer_filter_oembed_html' ) );
+ $this->assertSame( 10, has_action( 'wp_head', 'embed_optimizer_render_generator' ) );
+ }
+
/**
* Test that the oEmbed HTML is filtered.
*
@@ -163,10 +168,9 @@ function ( array $attrs, string $javascript ) {
* @covers ::embed_optimizer_render_generator
*/
public function test_embed_optimizer_render_generator() {
- $this->assertSame( 10, has_action( 'wp_head', 'embed_optimizer_render_generator' ) );
$tag = get_echo( 'embed_optimizer_render_generator' );
$this->assertStringStartsWith( 'assertStringContainsString( 'generator', $tag );
- $this->assertStringContainsString( EMBED_OPTIMIZER_VERSION, $tag );
+ $this->assertStringContainsString( 'embed-optimizer ' . EMBED_OPTIMIZER_VERSION, $tag );
}
}
diff --git a/tests/plugins/optimization-detective/helper-tests.php b/tests/plugins/optimization-detective/helper-tests.php
index b8c9526bc7..13dab41a80 100644
--- a/tests/plugins/optimization-detective/helper-tests.php
+++ b/tests/plugins/optimization-detective/helper-tests.php
@@ -16,6 +16,6 @@ public function test_od_render_generator_meta_tag() {
$tag = get_echo( 'od_render_generator_meta_tag' );
$this->assertStringStartsWith( 'assertStringContainsString( 'generator', $tag );
- $this->assertStringContainsString( 'Optimization Detective ' . OPTIMIZATION_DETECTIVE_VERSION, $tag );
+ $this->assertStringContainsString( 'optimization-detective ' . OPTIMIZATION_DETECTIVE_VERSION, $tag );
}
}
diff --git a/tests/plugins/speculation-rules/speculation-rules-test.php b/tests/plugins/speculation-rules/speculation-rules-test.php
index 3715507765..8d102ecb45 100644
--- a/tests/plugins/speculation-rules/speculation-rules-test.php
+++ b/tests/plugins/speculation-rules/speculation-rules-test.php
@@ -19,6 +19,11 @@ public function tear_down() {
parent::tear_down();
}
+ public function test_hooks() {
+ $this->assertSame( 10, has_action( 'wp_footer', 'plsr_print_speculation_rules' ) );
+ $this->assertSame( 10, has_action( 'wp_head', 'plsr_render_generator_meta_tag' ) );
+ }
+
public function data_provider_to_test_print_speculation_rules(): array {
return array(
'xhtml' => array(
@@ -56,4 +61,16 @@ public function test_plsr_print_speculation_rules_without_html5_support( bool $h
$this->assertStringContainsString( '/* assertStringStartsWith( 'assertStringContainsString( 'generator', $tag );
+ $this->assertStringContainsString( 'speculation-rules ' . SPECULATION_RULES_VERSION, $tag );
+ }
}
diff --git a/tests/plugins/webp-uploads/load-tests.php b/tests/plugins/webp-uploads/load-tests.php
index e78297af12..45fd358e72 100644
--- a/tests/plugins/webp-uploads/load-tests.php
+++ b/tests/plugins/webp-uploads/load-tests.php
@@ -984,6 +984,18 @@ public function it_should_return_correct_quality_for_mime_types() {
$this->assertSame( 80, webp_uploads_modify_webp_quality( 80, 'image/jpeg' ), 'JPEG image quality should return default quality provided from WP filter wp_editor_set_quality.' );
}
+ /**
+ * Test printing the meta generator tag.
+ *
+ * @covers ::webp_uploads_render_generator
+ */
+ public function test_webp_uploads_render_generator() {
+ $tag = get_echo( 'webp_uploads_render_generator' );
+ $this->assertStringStartsWith( 'assertStringContainsString( 'generator', $tag );
+ $this->assertStringContainsString( 'webp-uploads ' . WEBP_UPLOADS_VERSION, $tag );
+ }
+
/**
* Runs (empty) hooks to satisfy webp_uploads_in_frontend_body() conditions.
*/