WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am using below code which should render next and previous post thumbnail but it is showing the current post thumbnail in Custom Post Type single page


$prevpost = get_previous_post(true);
$prevThumbnail = get_the_post_thumbnail($prevpost->ID, array(80,80) );

next_post_link('%link', '<span>' . $prevThumbnail . '</span>%title'); 

$nextpost = get_next_post(true);
$nextThumbnail = get_the_post_thumbnail($nextpost->ID, array(80,80) );

previous_post_link('%link', '<span>' . $nextThumbnail . '</span>%title');           


How to solve this?

share|improve this question
What Wordpress Debug Says ? – amit Aug 5 '12 at 12:26
up vote 1 down vote accepted

Try without passing the true argument to get_previous_post() function, because that paramters is used to get link of previous post of same category. Possibly you've not registered the category taxonomy while registering that custom post type.

share|improve this answer
Exactly that was the issue.. Thanks a lot.. – pixelngrain Aug 5 '12 at 14:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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