• Resolved Max

    (@panmac)


    Hi – I’m still learning this so let me know if anything is unclear or if I’m using the wrong terminology.

    I’m wondering how one would go about querying for posts that are assigned to two categories.

    For example, I’ve set up a custom post type called ‘resume_entry’. Each ‘resume_entry’ will be assigned to two custom taxonomy categories. For example, ‘red’ and ‘apple’. If I have a bunch of categories, let’s say: ‘red’, ‘blue’, ‘apple’, ‘orange’, ‘banana’ – I want to be able to pull all the posts that are assigned to the ‘red’ category AND the ‘apple’ category to display in my page template.

    Does any of that make sense? Currently I’m just querying for all the ‘resume_entry’ posts with WP_Query(‘post_type=resume_entry’); , but I want to specify within that type’s meta_box fields.

    I’ve googled a lot and found some complicated answers (many involving wpdb and arrays) but I’m hoping someone will have the patience to explain a solution to me.

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘can you query posts assigned to two categories?’ is closed to new replies.