• ragesoul

    (@ragesoul)


    searched through forum without answer im looking for, saw similar questions but just not working.
    i have two taxonomies : brands and products reviews
    reviews example : cellphones, tablets, cameras
    brands : apple, samsung, google
    since one brand can have different product reviews types i cant make them as children taxonomy
    using regular get_terms i get list of all brands that have reviews no matter what type of review it is

    tnx for any help in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m confused by what you’re trying achieve. Maybe it doesn’t matter much in the abstract.

    As a guess you want to query for some post type that contains a particular term from each taxonomy. Correct?

    Even if not quite right, the solution is likely using WP_Query with ‘tax_query’ arguments. There’s several examples using multiple taxonomies in the reference. You should be able to make something work out of this.

    Thread Starter ragesoul

    (@ragesoul)

    what im trying to do:
    taxonomy reviews –> smartphones, tablets, cameras , etc
    taxonomy brands –> apple, samsung, htc etc..

    when i select tablets i wanna be able to filter only brands that have tablets reviews, example : apple, samsung .. and i need to be able to query this at any time so if i select something else i can display links of brands that contains tablet reviews. I need it done with two taxonomies. Displaying posts works perfectly, just need taxonomy names.

    Moderator bcworkz

    (@bcworkz)

    Thanks for clarifying, it is as I thought, use ‘tax_query’ to specify that you want posts that have a particular term in each of the two taxonomies. You can specify terms either by ID or slug. If this is to be applied to the main query, hook ‘pre_get_posts’ action and set the query var ‘tax_query’ to an array that describes the taxonomies and terms desired. Examples of the array structure are in the previously linked reference.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘display taxonomies that contain other taxonomy’ is closed to new replies.