WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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;

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


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.