• I have tried to follow instructions to add code to my single.php page in order to restrict the navigation links to the same category, but when I do, the next and previous buttons just DISAPPEAR completely!

    It orginally was like this on my single.php page:

    the_post_navigation( );

    —————————————-

    And I changed it to this:

    the_post_navigation( array(
    ‘prev_text’ => __( ‘prev chapter: %title’ ),
    ‘next_text’ => __( ‘next chapter: %title’ ),
    ‘in_same_term’ => true,
    ‘taxonomy’ => __( ‘post_tag’ ),
    ‘screen_reader_text’ => __( ‘Continue Reading’ ),
    ) );

    ————————

    As per this page: https://developer.www.ads-software.com/reference/functions/the_post_navigation/

    … But then no prev/next links show up on my posts page!!

    What am I doing wrong?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Your words say “in same category”, but your code says “in same tag”.
    Do your posts have the same tag?

    Thread Starter frustrated101

    (@frustrated101)

    I changed it to post_category but the website breaks and I get an error message and the site doesn’t load.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trouble restricting Next/Previous Links to same category’ is closed to new replies.