diff --git a/plugins/auto-sizes/hooks.php b/plugins/auto-sizes/hooks.php index 4bcb26114..721ecea84 100644 --- a/plugins/auto-sizes/hooks.php +++ b/plugins/auto-sizes/hooks.php @@ -30,7 +30,7 @@ function auto_sizes_update_image_attributes( $attr ) { } // Don't add 'auto' to the sizes attribute if it already exists. - if ( false !== strpos( $attr['sizes'], 'auto,' ) ) { + if ( str_contains( $attr['sizes'], 'auto,' ) ) { return $attr; } diff --git a/plugins/optimization-detective/optimization.php b/plugins/optimization-detective/optimization.php index 51dec58ff..9ee0b81c0 100644 --- a/plugins/optimization-detective/optimization.php +++ b/plugins/optimization-detective/optimization.php @@ -80,7 +80,7 @@ function od_can_optimize_response(): bool { // Since injection of inline-editing controls interfere with breadcrumbs, while also just not necessary in this context. is_customize_preview() || // Since the images detected in the response body of a POST request cannot, by definition, be cached. - 'GET' !== $_SERVER['REQUEST_METHOD'] || + ( isset( $_SERVER['REQUEST_METHOD'] ) && 'GET' !== $_SERVER['REQUEST_METHOD'] ) || // The aim is to optimize pages for the majority of site visitors, not those who administer the site. For admin // users, additional elements will be present like the script from wp_customize_support_script() which will // interfere with the XPath indices. Note that od_get_normalized_query_vars() is varied by is_user_logged_in()