从模板重定向到父页面 - Wordpress

I got a template that i use like a block in his parent page, and i would like to redirect this template.

Could you tell me how can i redirect my page who got a template name to his parent page ?

I don't know how i can detect the template in my hook ...

i would like to do something like that :

add_action( 'template_redirect', 'wpnc_redirect_single' );
function wpnc_redirect_single() {
    $queried_post_type = get_query_var('post_type');
    if ( is_single() && 'reference' ==  $queried_post_type ) {
        wp_redirect( home_url(), 301 );
        exit;
    }
}

But here it's for a custom type

Thanks

if (is_page_template("templates/template-pdf.php")){
wp_redirect( home_url(), 301 );
 exit;
 }

Like that