$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:
parent
7058969895
commit
e2ccc8d28f
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue