0

How can I restrict the post navigation to only posts from within the current category?

<!-- the post navigation -->
<?php
    the_post_navigation( array(
        'screen_reader_text'    => __( 'MORE EVENTS' ),
        'prev_text'             => __( 'Previous: ' ) . '%title',
        'next_text'             => __( 'Next: ' ) . '%title'
    ) );
?>
1

Customize your posts navigation to get posts in the same tag.

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

Source

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.