Support » Themes and Templates » 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] “

    $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?

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