Can I pass a query to a custom post type using a custom taxonomy?
-
Hi,
I started a discussion about showing custom post types on a custom page here, but since then I ran into another issue, which I believe is a separate matter so here it goes:
In my website I am currently using:
1. Posts for property adverts.
2. A custom post type called partner for our partners nationwide.
3. Categories for property types (eg: House, Flat, Condo, etc).
4. A custom taxonomy type called city for listing our cities (eg: Rome, Milan, Madrid, etc). This taxonomy is used by BOTH posts (properties) and partners.5. index.php only shows posts of the type post (the default post type used for property adverts).
6. page-partners.php shows the posts of the type partner (the custom type I created for our partners nationwide).So far so good. This is all working fine. However, I noticed a little nuisance with queries being passed using the URL:
When I browse the categories of my site (eg: /flats/ or /houses/, I can use a query in the URL for my custom taxonomy called city and it works like a charm. But with my custom post type partner, it doesn’t work.
For example, if I add to my URL: /house/?city=rome
— WORKS: It will return to me all the posts in the category house that only have the city Rome assigned to them (rome is a term of my custom taxonomy called city).However, if I try the above example of using a query in the URL, it doesn’t work.
For example, if I add to my URL: /partners/?city=rome
— WON’T WORK: Instead of returning all the posts of type partner that only have the city Rome assigned to them, I still returns me all the partners regardless of their city.Any ideas of what I might be doing wrong?
Thanks in advance,
P.
- The topic ‘Can I pass a query to a custom post type using a custom taxonomy?’ is closed to new replies.