Query CPT that share the same taxonomy as the current CPT
-
Hello
I have 2 CPT
1. Organisation
2. products.I also created a taxonomy called City that is used for both CPT.
I have products that are sold only in specific cities. On the Locations single page, I would like to display 3 of the products sold in that specific location. So I need to query posts with Product CPT AND same taxonomy (city) as the current Organisation.
For example, on the single page of the Organization in New York, I want to display a max of 3 products sold only in New York.
Usually I would use WP_Query to display the posts from products with the term New York and add it to the Organisation Single page. However, I would like WordPress to check the current taxonomy of the single Organisation page and display max 3 of the product with the SAME taxonomy.
Is it possible to do it? If yes, please could you help?
- The topic ‘Query CPT that share the same taxonomy as the current CPT’ is closed to new replies.