Home Redirect from template to parent page - Wordpress
Reply: 0

Redirect from template to parent page - Wordpress

user696 Published in July 21, 2018, 1:37 pm

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 );

But here it's for a custom type


You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308847 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO