Support » Plugin: CPT-onomies: Using Custom Post Types as Taxonomies » Archive Page Slug problem

  • Resolved toojee



    I have trouble to understand how CTP-onomies works with archive page.
    I have a CPT “hotel” and another CPT “city”.
    In CPT-onomies city I have checked the “Attach to Post Types” hotel to get city at the right of admin post hotel. That works and that ok.

    But for the Archive Page Slug for all hotel in a city I want “” for example. But in city cpt archive slug i have “”.

    It is possible to that with this plugin?
    Because the $post_type refer to city and not to hotel… In fact I will use city with another CPT later like house for example. I will need with same CPT city “” to show just the house in new york.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Rachel Cherry


    I’d check out the documentation for Custom CPT-onomy Archive Pages. I think you’ll find your answer there.

    Thanks for the answer!

    I wrote this rule in functions.php :
    add_rewrite_rule( "^hotel/city/([^/]*)/?", "index.php?post_type=hotel&city=$matches[1]&cpt_onomy_archive=1", "top" );

    When i go in url like “” I have a archive page but not whith the hotels in new york city. I have listed all the hotels in all cities. In the sql query I don’t see city involve.

    “city” is of course a post type attach to post type “hotel”.
    I need to do something more to make this working?

    Ok sorry I find my problem!
    With help of Rewrite Rules Inspector plugin I see I use double quotes intead of simple quote in add_rewrite_rule, so php convert $matches[1] to nothing.

    This works perfectly!

    Plugin Author Rachel Cherry


    Awesome! Glad you figured it out!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Archive Page Slug problem’ is closed to new replies.