Custom Post Type with static page for archive

I have created a custom post type 'books', but I don’t want to use archive-books.php to list the books. I need to use a static page to list my books because I would like to add content using the content editor.

I would like this structure:
www.example.com/books —-> It is a static page
www.example.com/books/book-title —> it is single post type

The problem is that I get a 404 when I try to go into my single post.

Can you help me?

2 Answers
2

Set has_archive to false. In order to keep the URL structure you want (/books/book-name), you’ll need to add a rewrite rule:

'rewrite' => array('slug' => 'books'),

Leave a Comment