I'm not as good as many wordpress developers here and I hope someone can help me, I've created a Custom post types for hotel destinations with categories for country and city. When I go to mysite.com/destinations the posts show normally. But when I try to go to a category URL (say, new york for example) by going to mysite.com/destinations/new-york I "get no posts where found".

On functions.php The only thing I have regarding the custom post types is that I only call the custom post types php page


On hotels-manager.php where I actually create the custom post type I have:

function hotel_manager_register()

    $labels = array(
        'name' => __( 'Hotels Manager' ),
        'singular_name' => __( 'Hotel' ),
        'add_new' => __( 'Add New' ),
        'add_new_item' => __( 'Add New Hotel' ),
        'edit_item' => __( 'Edit Hotel' ),
        'new_item' => __( 'New Hotel' ),
        'view_item' => __( 'View Hotel' ),
        'search_items' => __( 'Search Hotel' ),
        'not_found' => __( 'No Hotel Found' ),
        'not_found_in_trash' => __( 'No Hotel Found In Trash' ),
        'parent_item_colon' => '',
        'menu_name' => __( 'Hotels Manager' )
    $args = array(
        'labels' => $labels,
        'menu_icon' => 'dashicons-admin-multisite',
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'destinations', 'with_front' => false),
        'capability_type' => 'post',
        'hierarchical' => true,
        'menu_position' => null,
        'has_archive' => true,
        'supports' => array( 'title','editor', 'thumbnail', 'revisions', 'custom-fields')

    register_post_type( 'destinations', $args);
add_action('init', 'hotel_manager_register');
 // hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_destinations_taxonomies', 0 );

// create two taxonomies, genres and writers for the post type "book"
    function create_destinations_taxonomies() {
        $labels = array(
            'name' => __('Hotel Regions'),
            'singular_name' => __('Region'),
            'search_items' => __('Search Regions'),
            'all_items' => __('All Regions'),
            'parent_item' => __('Parent'),
            'parent_item_colon' => __('Parent:'),
            'edit_item' => __('Edit Region'),
            'update_item' => __('Update Region'),
            'add_new_item' => __('Add New Region'),
            'new_item_name' => __('New Region'),
            'menu_name' => __('Regions'),
        $args = array(
            'hierarchical' => true,
            'labels' => $labels,
            'show_ui' => true,
            'show_admin_column' => true,
            'query_var' => true,
            'rewrite' => array( 'slug' => 'destinations','with_front' => false ),
        register_taxonomy( 'destinations', array( 'destinations', 'public' => true, ), $args ); 


And finally index.php simply calls:

<?php get_header(); ?>
    <section class="stage">
        <div class="container">
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <h1><?php the_title(); ?></h1>              
             <?php the_content('Read More...'); ?>
            <?php endwhile; else: ?>
            <p><?php _e('No posts were found. Sorry!'); ?></p>
            <?php endif; ?>
<?php get_footer(); ?>

Any help would be really, really appreciated.

1 Answer 1


You are specifying the same slug of destinations for both your custom post type and for your taxonomy, unfortunately by default this doesn't behave how you'd expect due to WordPress' rewrite API. Which caters for the default nature of posts, archives, taxonomies, slugs and the WordPress template hierarchy.

If this URL structure is not important to you then you could change one of your slugs to destinations and the other to destination. Ensuring you flush your rewrite rules after doing so

Alternatively if this URL structure is important you may find this answer useful

  • Thank you so much!! I didn't realized that, I really don't care about different slugs. actually it worked better because mysite.com/destinations as stated display all the destinations and mysite.com/destination/newyork works better because I'm currently looking at hotels in one particular destination. Thanks!
    – Joxmar
    Apr 11, 2019 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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