$post validation on Cart and Checkout template (https://github.com/woocommerce/woocommerce-blocks/pull/10410)

Co-authored-by: Luigi Teschio <gigitux@gmail.com>
This commit is contained in:
Paulo Arromba 2023-07-31 13:49:34 +03:00 committed by GitHub
parent be7fb56637
commit e40d630b54
2 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ class CartTemplate extends AbstractPageTemplate {
*/
protected function is_active_template() {
global $post;
return get_option( 'woocommerce_cart_page_endpoint' ) === $post->post_name;
return $post instanceof \WP_Post && get_option( 'woocommerce_cart_page_endpoint' ) === $post->post_name;
}
/**

View File

@ -42,6 +42,6 @@ class CheckoutTemplate extends AbstractPageTemplate {
*/
public function is_active_template() {
global $post;
return get_option( 'woocommerce_checkout_page_endpoint' ) === $post->post_name;
return $post instanceof \WP_Post && get_option( 'woocommerce_checkout_page_endpoint' ) === $post->post_name;
}
}