Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
1  
Darko, Thank you, looks like your memory is a was a little hazy but I was able to sort it out. Here's what I wound up with and it's seams to solve my issue. (Can't figure out how to enter returns in comments, sorry for the lack of formatting...): function remove_link( $format ) { return false; } add_filter( 'previous_post_link', 'remove_link' ); add_filter( 'next_post_link', 'remove_link' ); –  Jason M Jan 30 '13 at 17:44
    
Oh oh, sorry about that! Will fix it, but glad you got it working. –  Darko Stanimirović Feb 1 '13 at 20:54

Your Answer

 
discard

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.