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 have a custom post type called "recipe" with the has_archive parameter set to true. Visiting mysite.com/recipe/ gives a basic archive list of all the recipes posted and a page title of "Recipes". So far so good.

Now I'm looking to disable that recipe archive page (but keep individual recipe links working). My first thought was to try setting has_archive to false, which sounds like it should do the trick. Nope. The only difference this makes is the page title which for some reason becomes the name of the site. The actual archive is still displayed.

What is the best way to actually remove that archive completely? Is there a parameter of register_post_type that will achieve this or is it impossible and a case of a custom page template with a redirect in it?

Thanks.

share|improve this question
1  
Did you flush your rewrite rules after setting 'has_archive' => false? –  Chip Bennett Oct 10 '13 at 11:53
    
Good point @ChipBennett, I did not! Works as expected now, thanks :) –  Shellbot Oct 10 '13 at 12:07
add comment

1 Answer

up vote 4 down vote accepted

The has_archive parameter for register_post_type() does exactly what you expect it to do. However, it modifies rewrite rules when set. So, if you change it to false, you'll need to flush your rewrite rules in order for the archive index display to be removed entirely.

share|improve this answer
add comment

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.