A possible code solution for this may be the following:
/**
* Remove certain posts from appearing in adjancency
*
* @param String $html - Final Output HTML
* @param String $format - Link anchor format
* @param String $link - Link URL format
* @param WP_Post $given_post - The given WP Post
* @param String $adjancency - next/previous
*/
function wpf12784795_remove_adjacent_post( $html, $format, $link, $given_post, $adjancency ) {
global $post;
/**
* Preferably these should be IDs since they don't change
* But they could be any Post property such as Slug or Title
*/
$forbidden_posts = array(
123,
);
// Check if the given post ID is in our forbidden Array
if( ! empty( $given_post ) && in_array( $given_post->ID, $forbidden_posts ) ) {
// Temporarily overwrite the global $post object
$post = $given_post;
$html = get_adjacent_post_link(
$format,
$link,
$in_same_term = false, // Whether it matters to grab an adjancent post from the same category/term
$exclude_terms = '', // Exclude any specific terms by ID
$previous = ( 'previous' === $adjancency ), // Whether it's a previous or next adjancency
$taxonomy = 'category' // Custom taxonomy if not dealing with the built-in category
);
// Reset the global $post object
wp_reset_postdata();
}
// Always return the HTML
return $html;
}
add_filter( 'previous_post_link', 'wpf12784795_remove_adjacent_post', 10, 5 );
add_filter( 'next_post_link', 'wpf12784795_remove_adjacent_post', 10, 5 );
The above does not work on all prev/next post links so it depends which specific function you’re using. I don’t know of a plugin that will help you in this regard though so if the above does not work for you then you’ll need to dig deeper to figure out what function(s) is generating the links.