From 57bbcf94b7f64c5f5532c452f7f1673c4fb90830 Mon Sep 17 00:00:00 2001 From: Thomas Patrick Levy Date: Wed, 8 May 2019 17:35:28 -0700 Subject: [PATCH 1/2] add filter to allow disabling endpoint 404 behavior, per #23622 --- includes/wc-template-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 1425babb547..b8224c775fe 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -43,7 +43,7 @@ function wc_template_redirect() { } // Trigger 404 if trying to access an endpoint on wrong page. - if ( is_wc_endpoint_url() && ! is_account_page() && ! is_checkout() ) { + if ( is_wc_endpoint_url() && ! is_account_page() && ! is_checkout() && apply_filters( 'woocommerce_account_endpoints_on_wrong_page_not_found', true ) ) { $wp_query->set_404(); status_header( 404 ); include( get_query_template( '404' ) ); From 4e58b098e5a60f661d376eae6141accfa818368a Mon Sep 17 00:00:00 2001 From: Thomas Patrick Levy Date: Thu, 9 May 2019 15:49:03 -0700 Subject: [PATCH 2/2] update filter --- includes/wc-template-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index b8224c775fe..e9c02435779 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -43,7 +43,7 @@ function wc_template_redirect() { } // Trigger 404 if trying to access an endpoint on wrong page. - if ( is_wc_endpoint_url() && ! is_account_page() && ! is_checkout() && apply_filters( 'woocommerce_account_endpoints_on_wrong_page_not_found', true ) ) { + if ( is_wc_endpoint_url() && ! is_account_page() && ! is_checkout() && apply_filters( 'woocommerce_account_endpoint_page_not_found', true ) ) { $wp_query->set_404(); status_header( 404 ); include( get_query_template( '404' ) );