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 think the question is straight forward. I want to have archive page, but want the single pages gone. Is there a way with custom post type options?

share|improve this question

2 Answers 2

You can force single queries to 404 like they don't exist.

function wpse67329_force_mycpt_single_404() {
  if ( is_single() && get_post_type() == 'mycpt' ) {
    global $wp_query;
    $wp_query->set_404();
    status_header('404');
  }
}

add_action( 'template_redirect', 'wpse67329_force_mycpt_single_404' );
share|improve this answer
    
A little more tidy way is using same approach but redirect to archive page instead of trigerring 404. That way links from admin would remain usable, etc. –  Rarst Oct 9 '12 at 1:40

The way I solve issues like that is that I just don't link to the single pages. So if there is no link, to the outside visitor it seems like there are no single posts.

share|improve this answer

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.