Reputation: 83
I have a custom post type called Branches which just displays different location information for multiple branches for our company. And the individual posts for Branches live under /branch/individual-branch-post
.
Next, I have a page Called Branch where we have some child pages nested under there with just static information, also about different branch locations. If I try to go to one of those child pages I get a 404.
The thing is that we need /branch
to coexist with the custom posts and the child pages because they both house the same type of information.
I have been scouring the internet but can't find a solution for this.
Upvotes: 0
Views: 314
Reputation: 61
There is probably a conflict with the slug of the page and the rewrite-slug of the custom post type. If you have set has_archive => true when you register the custom post type and a page exists with the same slug, this error will happen. Try setting has_archive to false and refresh permalinks via the settings ( "Settings > Permalinks").
Edit:
My bad, I did not see the "coexist" statement in your question. I have not found a way to do this myself, but I guess you'd had to tinker with the rewrite-rules to achieve this.
I am wondering: If the content is similar; why not using the post type instead of pages and then use the built-in archive.php template?
Like Ruvee mentioned, you could set the post type to be hierarchical, by setting 'hierarchical' to true. Then the post type would "behave" quite similar to how the pages look and feel.
Upvotes: 1