Support » Plugin: Attachment Pages Redirect » why plugin

Viewing 3 replies - 1 through 3 (of 3 total)
  • Tecca

    (@tecca)

    That didn’t work on my end; it created a redirect that looped forever.

    I used this:

    <?php
    header ('HTTP/1.1 301 Moved Permanently');
    header ('Location: '.get_permalink($post->post_parent));
    ?>
    Thread Starter zabatonni

    (@zabatonni)

    sorry there was a mistake, try this:

    <?php
    $attached=$post->post_parent;
    
    if($attached==0) {
    wp_redirect(get_bloginfo('url'), 307);
    exit();
    }
    else {
    wp_redirect(get_permalink($attached), 301);
    exit();
    }
    ?>
    Tecca

    (@tecca)

    That works perfectly. Thanks for that, zabatonni.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘why plugin’ is closed to new replies.