You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/performance-lab/includes/site-health/bfcache-compatibility-headers/helper.php
+5-31Lines changed: 5 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ function perflab_bfcache_compatibility_headers_check(): array {
29
29
'color' => 'blue',
30
30
),
31
31
'description' => '<p>' . wp_kses(
32
-
__( 'If the <code>Cache-Control</code> page response header includes directives like <code>no-store</code>, <code>no-cache</code>, or <code>max-age=0</code> then it can prevent instant back/forward navigations (using the browser bfcache). These are not present for unauthenticated requests on your site, so it is configured properly. Note that WordPress adds these directives for logged-in page responses.', 'performance-lab' ),
32
+
__( "If the <code>Cache-Control</code> page response header includes the <code>no-store</code> directive then it can prevent instant back/forward navigations (using the browser's bfcache). This is not present for unauthenticated requests on your site, so it is configured properly. Note that there are other ways that bfcache can be disabled (e.g. you have JavaScript which uses a <code>unload</code> event listener). Also note that WordPress adds this directive for logged-in page responses for privacy/security reasons.", 'performance-lab' ),
33
33
array( 'code' => array() )
34
34
) . '</p>',
35
35
'actions' => '',
@@ -66,41 +66,15 @@ function perflab_bfcache_compatibility_headers_check(): array {
if ( str_contains( $cache_control_header, $directive ) ) {
73
-
$found_directives[] = $directive;
74
-
}
75
-
}
76
-
77
-
if ( count( $found_directives ) > 0 ) {
69
+
if ( str_contains( strtolower( $cache_control_header ), 'no-store' ) ) {
78
70
$result['label'] = __( 'The Cache-Control page header is preventing fast back/forward navigations', 'performance-lab' );
79
71
$result['status'] = 'recommended';
80
72
$result['description'] = sprintf(
81
-
'<p>%s %s</p>',
73
+
'<p>%s</p>',
82
74
wp_kses(
83
-
sprintf(
84
-
/* translators: %s: problematic directive(s) */
85
-
_n(
86
-
'The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directive: %s.',
87
-
'The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directives: %s.',
88
-
count( $found_directives ),
89
-
'performance-lab'
90
-
),
91
-
implode(
92
-
', ',
93
-
array_map(
94
-
staticfunction ( $header ) {
95
-
return"<code>$header</code>";
96
-
},
97
-
$found_directives
98
-
)
99
-
)
100
-
),
75
+
__( "The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the <code>no-store</code> directive. This can affect the performance of your site by preventing fast back/forward navigations (via the browser's bfcache).", 'performance-lab' ),
101
76
array( 'code' => array() )
102
-
),
103
-
esc_html__( 'This can affect the performance of your site by preventing fast back/forward navigations (via browser bfcache).', 'performance-lab' )
Copy file name to clipboardExpand all lines: plugins/performance-lab/tests/includes/site-health/bfcache-compatibility-headers/test-bfcache-compatibility-headers.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -82,27 +82,27 @@ public function data_test_bfcache_compatibility(): array {
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directive: <code>no-store</code>',
90
+
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes',
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes the following directive: <code>no-store</code>',
105
+
'<p>The <code>Cache-Control</code> response header for an unauthenticated request to the home page includes',
0 commit comments