I’m creating a plugin that uses a custom post type. I do not want to make a custom template for viewing the posts and discovered I can add a filter for the_content to include my custom fields, this works great. However, I don’t want visitors to navigate the custom post types with the previous next navigation. It there a way to remove these without creating a custom template?
Thank you for taking the time to look at my issue.
1 Answer
Try this:
function remove_link( $format, $link ) {
return false;
}
add_filter( 'previous_post_link', 'remove_link' );
add_filter( 'next_post_link', 'remove_link' );
It should work if the theme uses next_post_link()
and previous_post_link()
.
Cheers