Looking for advice, recommendations or suggestions for the most appropriate page structure for a website.

I am migrating a website which has about 1000 pages in the structure of /service/location/ – There are 4 services and about 250 locations

I leaning away from creating them as pages as it will just clog up the Pages section of the site making it cumbersome to find and edit core pages.

I was thinking of using categories and posts but this customer wants to do some blogging so I’m leaning away from clogging up the posts section as well.

I was thinking of a custom post type BUT the custom post type will add a slug at the beginning (e.g. /custom-slug/service/location/ ) which will mean that I will need to 301 redirect the 1000 URLs on the new site from /service/location/ to /custom-slug/service/location/).

I am leaning towards creating 4 custom post types (the 4 services) and then creating the 250 custom posts per customer post type – but I don’t like the thought of having 4 extra menus/sections in admin (I could probably get over it – but I’m thinking that there’s got to be a cleaner way) OR Just dealing with Categories and posts and ignoring over the “clogging up” issue…

Does anyone have any recommendations or suggestions? Is there a more appropriate way to do this?


You can make CPT's have "slugless" permalinks fairly easily:

register_post_type( 'service', [
    'hierarchical' => true,
    'public'       => true,
    // Other args, no need for "rewrite"

// Change service to top-level permalink.
add_permastruct( 'service', '%service%', [
    'with_front' => false,
    'paged'      => false,
    'feed'       => false,

// Remove all default service rewrite rules.
add_filter( 'service_rewrite_rules', '__return_empty_array' );

... which should be wrapped in a function and hooked to init. Then to "catch" these post types, we need a little pre_get_posts magic:

add_action( 'pre_get_posts', function ( $wp_query ) {
    if (
        $wp_query->is_main_query() &&
        $wp_query->is_singular() &&
        $wp_query->get( 'pagename' )
    ) {
        if ( ! $post_type = $wp_query->get( 'post_type' ) )
            $post_type = [];
        elseif ( ! is_array( $post_type ) )
            $post_type = [ $post_type ];

        $wp_query->set( 'post_type', array_merge( $post_type, [

Make sure to then flush your rewrite rules (just load Settings > Permalinks in the admin).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.