Merge pull request #32747 from crstauf/patch-1
Fix `is_page()` and `is_singular()` called incorrectly
This commit is contained in:
commit
e74a106fe8
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Add check for $wp_query before calling is_cart to prevent doing_it_wrong notice.
|
|
@ -41,6 +41,8 @@ class WC_Cache_Helper {
|
||||||
* @since 3.6.0
|
* @since 3.6.0
|
||||||
*/
|
*/
|
||||||
public static function additional_nocache_headers( $headers ) {
|
public static function additional_nocache_headers( $headers ) {
|
||||||
|
global $wp_query;
|
||||||
|
|
||||||
$agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
$agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||||
|
|
||||||
$set_cache = false;
|
$set_cache = false;
|
||||||
|
@ -64,7 +66,7 @@ class WC_Cache_Helper {
|
||||||
$set_cache = true;
|
$set_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( false !== strpos( $agent, 'Chrome' ) && is_cart() ) {
|
if ( false !== strpos( $agent, 'Chrome' ) && isset( $wp_query ) && is_cart() ) {
|
||||||
$set_cache = true;
|
$set_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue