• My site has a custom taxonomy called “artists” and has been using this code to show the next and previous post within that taxonomy:

    <div class="next"><?php next_post_link('&larr; %link', '%title', true, '', 'artists'); ?></div>
    <div class="prev"><?php previous_post_link('%link &rarr;', '%title', true, '', 'artists'); ?></div>

    Since the latest WP update it now just shows the next and previous post in all taxonomies.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Code looks ok, latest update didn’t changed this 2 functions, the issue must be from somewhere else, are you using this in a page template? issue might come if the main query altered in that template and it’s not reseted … can you share all the code so we can have a look at it?

    Thread Starter Mattbob

    (@mattj1s)

    Here’s the full code of the loop. I added the wp_reset_query function but that didn’t seem to fix it.

    <?php wp_reset_query(); if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<!--BEGIN .hentry -->
    	<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    		<div class="row">
    			<div class="<?php echo cherry_get_layout_class( 'left_block' ); ?>">
    				<figure class="thumbnail">
    					<?php
    					$image_id = get_post_thumbnail_id(get_the_id());
    					$image = wp_get_attachment_url($image_id);
    					?>
    					<a href="<?php echo $image; ?>" rel="prettyPhoto" class="image-wrap">
    						<?php the_post_thumbnail('full'); ?>
    						<span class="zoom-icon"></span>
    					</a>
    				</figure>
    
    				<div class="next"><?php next_post_link('&larr; %link', '%title', true, '', 'artists'); ?></div>
    				<div class="prev"><?php previous_post_link('%link &rarr;', '%title', true, '', 'artists'); ?></div>
    			</div>
    		</div><!-- .row -->
    	</div>
    <?php endwhile; endif; ?>
    Thread Starter Mattbob

    (@mattj1s)

    Is there another way of getting the previous and next post within the same taxonomy?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘next_post_link and prev_post_link not working since recent update’ is closed to new replies.