WordPress.org

Support

Support » Themes and Templates » Redirecting Post to its Term

Redirecting Post to its Term

  • I am trying to redirect post to its term (in custom post type).
    I tried following in single-[post-type] “

    <?php
    $taxonomy= 'resource-list';
    $terms = get_the_terms( $post->ID, $taxonomy );
    $term_id = $terms[0]->term_id;
    $relocate = get_term_link($term_id);
    header("Location:" .$relocate);
    ?>

    But it is resulting a WP_Error.

    Can anyone point me in right direction?
    Thanks.

  • The topic ‘Redirecting Post to its Term’ is closed to new replies.