Sorry if this is a duplicate – I can’t find an answer.
How do I rewrite a custom post type archive page to a ‘man-made’ WordPress page?
- Single page:
- Archive page:
http://www.mywebsite.com/cool-post-type/ to rewrite to
Can I just do this with htaccess and what would the syntax be? (I’m not good at htaccess!)
This does not work:
RewriteRule ^cool-post-type\/\?$ /about-cool-post-types [L]
Or do I have to do this in the WordPress source code? I don’t want to!
This one’s actually pretty easy. When you declare your post type using register_post_type, you need to add a new argument for ‘has_archive’.
So you’ll add in something to the effect of:
'has_archive' => 'about-cool-post-types'
Then, go to your Settings > Permalinks to flush them and it should work. I tested it locally, and this seems to be the way to automatically generate your archive page at a different URL. Then, you should be able to create a page at the CPT’s slug.