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?


1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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