I'm having some issues with some url structures on my current WP project.
I have a cpt and a page with the same name and URL structure. This obviously generates som issues. Since I have never really worked with the permalink structure of post vs pages I'm asking for some inputs on what choices I have.
I have a page called "ansatte" with a childpage called "bliv-frivillig".
Meanwhile I have a custom post type called ansatte with "ansatte" as its base url as well.
So when I try to access the "bliv-frivillig" childpage I'm greeted with a 404, since WP is looking for the post.
My dream scenario would be for both the pages and the cpt to share the base slug of "ansatte". Is this even possible in WP?
Here is my CPT args from functions:
$rewrite = array( 'slug' => 'ansatte', 'with_front' => true, 'pages' => false, 'feeds' => false, ); $args = array( 'label' => __( 'Ansat', 'mydomain' ), 'description' => __( 'Ansatte og tilknyttede til Museer', 'mydomain' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 35, 'menu_icon' => 'dashicons-groups', 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => true, //'with_front' => false, 'publicly_queryable' => true, 'capability_type' => 'page', );
The custom post type "ansatte" doesn't actually need to have a single post page, since it will only be prevented in custom queries.
I realized i could set public => false, publicly_queryable => false and with_front => false, so now at least the posts are not displayed in the front end. But when i try to access the child page "bliv-frivillig" (http://domain.com/ansatte/bliv-frivillig) I'm redirected to the frontpage.