WordPress.org

Ready to get started?Download WordPress

Forums

Page permalinks using same base slug for a custom post type and pages (2 posts)

  1. brainbrian
    Member
    Posted 1 year ago #

    I've been using custom post types in WordPress since the release of 3.0.

    I keep running into this issue and I've read quite a bit on the forums, but no one seems to be addressing my same issue...

    I'm trying to see if I can have pages live within the same slug as a custom post type. For example, say I have a custom post type of 'products' with the following arguments:

    $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => array("slug" => "products"),
            'capability_type' => 'page',
            'has_archive' => false,
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array( 'title', 'editor', 'page-attributes', 'comments' )
        );

    Because I have 'has_archive' set to false, I can easily set up my own overview page at the following permalink '/products/'... this page can have whatever custom code on it.

    My question, is there any way for me to have additional subpages besides the 'products' (CPT) themselves? For instance if I had a page about the products return policy and wanted the permalink to be '/products/returns'. I get a 404 every time I try to set that up and I've looked through all the arguments for setting up a custom post type and haven't had any luck.

    Any help would be greatly appreciated. I'm sure someone else has posted something similar, but I can't find this type of question specifically.

  2. brainbrian
    Member
    Posted 1 year ago #

    No one has any feedback on this? Do you have to do rewrites for individual pages themselves?

Topic Closed

This topic has been closed to new replies.

About this Topic