From 5c74b96b41c02f106c68545cb653c17b78e5b658 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 5 Jun 2024 10:21:12 -0700 Subject: [PATCH 1/4] Update readmes for OD and IP --- plugins/image-prioritizer/readme.txt | 6 ++++-- plugins/optimization-detective/readme.txt | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/image-prioritizer/readme.txt b/plugins/image-prioritizer/readme.txt index cd0083ca4c..5da697287e 100644 --- a/plugins/image-prioritizer/readme.txt +++ b/plugins/image-prioritizer/readme.txt @@ -7,7 +7,7 @@ Requires PHP: 7.2 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html -Tags: performance, images +Tags: performance, optimization, image, lcp, lazy-load Optimizes LCP image loading with `fetchpriority=high` and applies image lazy-loading by leveraging client-side detection with real user metrics. @@ -24,7 +24,9 @@ In addition to prioritizing the loading of the LCP image, this plugin also optim If an image does not appear in the initial viewport for any of these viewport groups, then `loading=lazy` is added to the `img` element. -Note that by default, URL Metrics are not gathered for administrator users, since they are not normal site visitors, and it is likely that additional elements will be present on the page which are not also shown to non-administrators. +👉 **Note:** This plugin optimizes pages for actual visitors, and it depends on visitors to optimize pages (since URL metrics need to be collected). As such, you won't see optimizations applied immediately after activating the plugin. And since administrator users are not normal visitors typically, optimizations are not applied for admins by default. + +There are currently **no settings** and no user interface for this plugin since it is designed to work without any configuration. This plugin requires the [Optimization Detective](https://wordpress.org/plugins/optimization-detective/) plugin as a dependency. Please refer to that plugin for additional background on how this plugin works as well as additional developer options. diff --git a/plugins/optimization-detective/readme.txt b/plugins/optimization-detective/readme.txt index 62ebeb0bd6..9abb8db7be 100644 --- a/plugins/optimization-detective/readme.txt +++ b/plugins/optimization-detective/readme.txt @@ -7,7 +7,7 @@ Requires PHP: 7.2 Stable tag: 0.3.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html -Tags: performance +Tags: performance, optimization, rum Provides an API for leveraging real user metrics to detect optimizations to apply on the frontend to improve page performance. @@ -27,9 +27,9 @@ At the core of Optimization Detective is the “URL Metric”, information about URL Metrics have a “freshness TTL” after which they will be stale and the JavaScript will be served again to start gathering metrics again to ensure that the right elements continue to get their loading prioritized. When a URL Metrics custom post type hasn't been touched in a while, it is automatically garbage-collected. -Prioritizing the loading of images which are the LCP element is only the first optimization implemented as a proof of concept for how other optimizations might also be applied. See a [list of issues](https://github.com/WordPress/performance/labels/%5BPlugin%5D%20Optimization%20Detective) for planned additional optimizations which are only feasible with the URL Metrics RUM data. +👉 **Note:** This plugin optimizes pages for actual visitors, and it depends on visitors to optimize pages (since URL metrics need to be collected). As such, you won't see optimizations applied immediately after activating the plugin (and dependent plugin(s)). And since administrator users are not normal visitors typically, optimizations are not applied for admins by default (but this can be overridden with the `od_can_optimize_response` filter below). URL metrics are not collected for administrators because it is likely that additional elements will be present on the page which are not also shown to non-administrators, meaning the URL metrics could not reliably be reused between them. -Note that by default, URL Metrics are not gathered for administrator users, since they are not normal site visitors, and it is likely that additional elements will be present on the page which are not also shown to non-administrators. +There are currently **no settings** and no user interface for this plugin since it is designed to work without any configuration. When the `WP_DEBUG` constant is enabled, additional logging for Optimization Detective is added to the browser console. @@ -135,6 +135,8 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu = 0.3.0 = +* The image optimization features have been split out into a new dependent plugin called [Image Prioritizer](https://wordpress.org/plugins/image-prioritizer/), which also now optimizes image lazy-loading. ([1088](https://github.com/WordPress/performance/issues/1088)) + = 0.2.0 = **Enhancements** From 2cb2f59ea22bc4be0a7371bb04b6baec5ef9be7f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 5 Jun 2024 10:22:03 -0700 Subject: [PATCH 2/4] Update since n.e.x.t tags --- ...mage-prioritizer-background-image-styled-tag-visitor.php | 4 ++-- .../class-image-prioritizer-img-tag-visitor.php | 4 ++-- .../class-image-prioritizer-tag-visitor.php | 4 ++-- plugins/image-prioritizer/helper.php | 6 +++--- plugins/image-prioritizer/hooks.php | 2 +- plugins/optimization-detective/class-od-html-tag-walker.php | 2 +- .../class-od-preload-link-collection.php | 4 ++-- .../class-od-tag-visitor-registry.php | 4 ++-- plugins/optimization-detective/optimization.php | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php b/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php index 47b9f54d50..7969d26f3b 100644 --- a/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php +++ b/plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php @@ -3,7 +3,7 @@ * Image Prioritizer: IP_Background_Image_Styled_Tag_Visitor class * * @package image-prioritizer - * @since n.e.x.t + * @since 0.1.0 */ // Exit if accessed directly. @@ -14,7 +14,7 @@ /** * Visitor for the tag walker that optimizes elements with background-image styles. * - * @since n.e.x.t + * @since 0.1.0 * @access private */ final class Image_Prioritizer_Background_Image_Styled_Tag_Visitor extends Image_Prioritizer_Tag_Visitor { diff --git a/plugins/image-prioritizer/class-image-prioritizer-img-tag-visitor.php b/plugins/image-prioritizer/class-image-prioritizer-img-tag-visitor.php index d39cc2dac2..ea057ed92d 100644 --- a/plugins/image-prioritizer/class-image-prioritizer-img-tag-visitor.php +++ b/plugins/image-prioritizer/class-image-prioritizer-img-tag-visitor.php @@ -3,7 +3,7 @@ * Image Prioritizer: IP_Img_Tag_Visitor class * * @package image-prioritizer - * @since n.e.x.t + * @since 0.1.0 */ // Exit if accessed directly. @@ -14,7 +14,7 @@ /** * Visitor for the tag walker that optimizes IMG tags. * - * @since n.e.x.t + * @since 0.1.0 * @access private */ final class Image_Prioritizer_Img_Tag_Visitor extends Image_Prioritizer_Tag_Visitor { diff --git a/plugins/image-prioritizer/class-image-prioritizer-tag-visitor.php b/plugins/image-prioritizer/class-image-prioritizer-tag-visitor.php index 1f438a9d2c..e70fc9421a 100644 --- a/plugins/image-prioritizer/class-image-prioritizer-tag-visitor.php +++ b/plugins/image-prioritizer/class-image-prioritizer-tag-visitor.php @@ -3,7 +3,7 @@ * Image Prioritizer: IP_Image_Tag_Visitor class * * @package image-prioritizer - * @since n.e.x.t + * @since 0.1.0 */ // Exit if accessed directly. @@ -14,7 +14,7 @@ /** * Visitor for the tag walker that optimizes image tags. * - * @since n.e.x.t + * @since 0.1.0 * @access private */ abstract class Image_Prioritizer_Tag_Visitor { diff --git a/plugins/image-prioritizer/helper.php b/plugins/image-prioritizer/helper.php index d0869a8773..9adb166754 100644 --- a/plugins/image-prioritizer/helper.php +++ b/plugins/image-prioritizer/helper.php @@ -3,7 +3,7 @@ * Helper functions for Image Prioritizer. * * @package image-prioritizer - * @since n.e.x.t + * @since 0.1.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -15,7 +15,7 @@ * * See {@see 'wp_head'}. * - * @since n.e.x.t + * @since 0.1.0 */ function image_prioritizer_render_generator_meta_tag(): void { // Use the plugin slug as it is immutable. @@ -25,7 +25,7 @@ function image_prioritizer_render_generator_meta_tag(): void { /** * Registers tag visitors for images. * - * @since n.e.x.t + * @since 0.1.0 * * @param OD_Tag_Visitor_Registry $registry Tag visitor registry. * @param OD_URL_Metrics_Group_Collection $url_metrics_group_collection URL Metrics Group Collection. diff --git a/plugins/image-prioritizer/hooks.php b/plugins/image-prioritizer/hooks.php index 0b4b35f773..aaefcca6e3 100644 --- a/plugins/image-prioritizer/hooks.php +++ b/plugins/image-prioritizer/hooks.php @@ -3,7 +3,7 @@ * Hook callbacks used for Image Prioritizer. * * @package image-prioritizer - * @since n.e.x.t + * @since 0.1.0 */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/plugins/optimization-detective/class-od-html-tag-walker.php b/plugins/optimization-detective/class-od-html-tag-walker.php index 1a742d2069..c338db6623 100644 --- a/plugins/optimization-detective/class-od-html-tag-walker.php +++ b/plugins/optimization-detective/class-od-html-tag-walker.php @@ -414,7 +414,7 @@ public function append_body_html( string $html ): bool { * This is a wrapper around the underlying WP_HTML_Tag_Processor method of the same name since only a limited number of * methods can be exposed to prevent moving the pointer in such a way as the breadcrumb calculation is invalidated. * - * @since n.e.x.t + * @since 0.3.0 * @see WP_HTML_Tag_Processor::get_tag() * * @return string|null Name of currently matched tag in input HTML, or `null` if none found. diff --git a/plugins/optimization-detective/class-od-preload-link-collection.php b/plugins/optimization-detective/class-od-preload-link-collection.php index 610349d0eb..6c0acdb8da 100644 --- a/plugins/optimization-detective/class-od-preload-link-collection.php +++ b/plugins/optimization-detective/class-od-preload-link-collection.php @@ -3,7 +3,7 @@ * Optimization Detective: OD_Preload_Link_Collection class * * @package optimization-detective - * @since n.e.x.t + * @since 0.3.0 */ // Exit if accessed directly. @@ -29,7 +29,7 @@ * as: 'audio'|'document'|'embed'|'fetch'|'font'|'image'|'object'|'script'|'style'|'track'|'video'|'worker' * } * - * @since n.e.x.t + * @since 0.3.0 * @access private */ final class OD_Preload_Link_Collection implements Countable { diff --git a/plugins/optimization-detective/class-od-tag-visitor-registry.php b/plugins/optimization-detective/class-od-tag-visitor-registry.php index 880cee15f6..40e4386b6a 100644 --- a/plugins/optimization-detective/class-od-tag-visitor-registry.php +++ b/plugins/optimization-detective/class-od-tag-visitor-registry.php @@ -3,7 +3,7 @@ * Optimization Detective: OD_Tag_Visitor_Registry class * * @package optimization-detective - * @since n.e.x.t + * @since 0.3.0 */ // Exit if accessed directly. @@ -18,7 +18,7 @@ * * @implements IteratorAggregate * - * @since n.e.x.t + * @since 0.3.0 * @access private */ final class OD_Tag_Visitor_Registry implements Countable, IteratorAggregate { diff --git a/plugins/optimization-detective/optimization.php b/plugins/optimization-detective/optimization.php index 34e554206f..e3a9696c85 100644 --- a/plugins/optimization-detective/optimization.php +++ b/plugins/optimization-detective/optimization.php @@ -167,7 +167,7 @@ function od_optimize_template_output_buffer( string $buffer ): string { /** * Fires to register tag visitors before walking over the document to perform optimizations. * - * @since n.e.x.t + * @since 0.3.0 * * @param OD_Tag_Visitor_Registry $tag_visitor_registry Tag visitor registry. * @param OD_URL_Metrics_Group_Collection $group_collection URL Metrics Group collection. From 29917e444fff7750669fc0c81677c002a328b85b Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 5 Jun 2024 10:41:13 -0700 Subject: [PATCH 3/4] Fix link to Trac ticket --- plugins/optimization-detective/readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/optimization-detective/readme.txt b/plugins/optimization-detective/readme.txt index 9abb8db7be..a5fa88f1d8 100644 --- a/plugins/optimization-detective/readme.txt +++ b/plugins/optimization-detective/readme.txt @@ -97,7 +97,7 @@ Filters the time window between serve time and run time in which loading detecti **Filter:** `od_template_output_buffer` (default: the HTML response) -Filters the template output buffer prior to sending to the client. This filter is added to implement #43258. +Filters the template output buffer prior to sending to the client. This filter is added to implement [#43258](https://core.trac.wordpress.org/ticket/43258) in WordPress core. == Installation == From 7f68623f433fc090ad63c5da81cd01610dc0d9c8 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 5 Jun 2024 10:45:05 -0700 Subject: [PATCH 4/4] Improve formatting of hooks readme section --- plugins/optimization-detective/readme.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/optimization-detective/readme.txt b/plugins/optimization-detective/readme.txt index a5fa88f1d8..3a31987c03 100644 --- a/plugins/optimization-detective/readme.txt +++ b/plugins/optimization-detective/readme.txt @@ -33,7 +33,7 @@ There are currently **no settings** and no user interface for this plugin since When the `WP_DEBUG` constant is enabled, additional logging for Optimization Detective is added to the browser console. -= Filters = += Hooks = **Filter:** `od_breakpoint_max_widths` (default: [480, 600, 782]) @@ -68,7 +68,9 @@ Filters the sample size for a breakpoint's URL metrics on a given URL. The sampl `