File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
plugins/optimization-detective/docs Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ Filters whether the current response can be optimized. By default, detection and
199
199
1 . It’s not a search template (` is_search() ` ).
200
200
2 . It’s not a post embed template (` is_embed() ` ).
201
201
3 . It’s not a preview (` is_preview() ` ).
202
- 4 . It’s not the Customizer preview (` is_customize_preview() ` );
202
+ 4 . It’s not the Customizer preview (` is_customize_preview() ` ).
203
203
5 . It’s not the response to a ` POST ` request.
204
204
6 . There is at least one queried post on the page. This is used to facilitate the purging of page caches after a new URL Metric is stored.
205
205
@@ -208,8 +208,8 @@ The filter now receives an additional `$disabled_flags` parameter that contains
208
208
For example, to enable optimization specifically for search pages:
209
209
210
210
``` php
211
- add_filter( 'od_can_optimize_response', function( $can_optimize, $disabled_flags ) {
212
- if ( ! $can_optimize && isset( $disabled_flags['is_search'] ) && $disabled_flags['is_search'] ) {
211
+ add_filter( 'od_can_optimize_response', function( $can_optimize, array $disabled_flags ): bool {
212
+ if ( ! $can_optimize && $disabled_flags['is_search'] ) {
213
213
unset( $disabled_flags['is_search'] );
214
214
$can_optimize = count( array_filter( $disabled_flags ) ) === 0;
215
215
}
You can’t perform that action at this time.
0 commit comments