Validate page template

This commit is contained in:
Claudio Sanches 2020-04-03 18:12:08 -03:00 committed by vedanshujain
parent 3dd2cb1a66
commit b62457dd01
1 changed files with 10 additions and 1 deletions

View File

@ -127,7 +127,16 @@ class WC_Template_Loader {
$templates[] = 'woocommerce.php';
if ( is_page_template() ) {
$templates[] = get_page_template_slug();
$page_template = get_page_template_slug();
if ( $page_template ) {
$validated_file = validate_file( $page_template );
if ( 0 === $validated_file ) {
$templates[] = $page_template;
} else {
error_log( "WooCommerce: Unable to validate template path: \"$page_template\". Error Code: $validated_file." );
}
}
}
if ( is_singular( 'product' ) ) {