-
The
{tax} => {term}
pattern is deprecated as of 3.1 you should be usingtax_query
, but your code should still work for some undetermined length of time. -
post_child
is not a parameter thatWP_Query
accepts. I don’t know what you expect that to do but at best it does nothing. This may be breaking you query, but I doubt it. I would expect it to be simply ignored.
What you should be using is this, pretty much straight from the Codex:
$args = array(
'post_type' => 'photos',
'tax_query' => array(
array(
'taxonomy' => 'technique',
'field' => 'slug',
'terms' => 'zevar'
)
),
'posts_per_page' => 10
);
$loop = new WP_Query( $args );
That code, plus a readable while
loop…
while ( $loop->have_posts() ) {
$loop->the_post();
the_title();
}
… does work. I tested it. Of course, you have to have the taxonomy setup correctly and you have to have posts in the post type with the right term.
Related Posts:
- Display all posts in a custom post type, grouped by a custom taxonomy
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Query for posts in 2 taxonomies
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- wp_query to find posts by year and month
- Custom Post Type Loop within Shortcode
- Filter by custom taxonomy slug on a custom post type
- Display CPT posts based on specific taxonomy
- Custom loop with multiple taxonomy queries
- What’s the WP way to load remaining custom posts?
- display posts of custom post type with custom taxonomy
- List all Custom Post Type posts excluding certain Taxnomy term
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- What is the most efficient way to execute recursive complex queries?
- Loop with Custom Post Type and Taxonomies
- Post data in separate divs with incrementing class using WP_Query
- Catergory args causing loop not to show
- display custom post type from register taxonomy
- Complex Custom Loop with Includes
- How to use a custom post type as front page?
- Custom Taxonomy with Custom Post Type Finds No Posts
- Display several random posts, but make sure a condition is met
- Custom query – alternate posts by category
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- Retrieving 3 latest post from each of 5 different custom post types
- how to group custom post type posts by custom taxonomy terms
- Randomly placed sticky custom posts complemented by blog posts
- Multiple Archive Pages for Custom Post Types AND Taxonomies
- Exclude current post when getting related post on custom post type and taxonomy
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Ordering Custom Post Types with WP_Query
- Querying CPT with Two Taxonomies
- Custom Query to display posts with custom field
- Get taxonomy description based on variable
- Loop on front-page.php
- Querying Term Posts in Loop
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- WP_Query | ‘post_type’ doesn’t work
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Loop through Custom Post Type, and then show children within each iteration
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Can I create a loop with multiple post types and specify different $args for each post type?
- Am unable to reset a query properly
- How to make sure content doesn’t display if selection is empty
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Get next and previous 3 posts in a term in single post page
- wp_query check if integer exists in custom field’s array
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Custom-Posttype & Custom Taxonomy WP_Query
- Return the latest post from a custom Taxonomy and Post Type
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- Full Custom Post Type List Organised by two Taxonomies
- Query Custom Post Type Taxonomy term with multiple parameters
- pagination not working for category.php (custom post types in categories)
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- Retrieve custom post types by custom taxonomies with WP_Query
- WP Query post__in not returning correct results
- Custon Content within WordPress Loop
- Using page slug in wp_query
- Custom taxonomy wp_query woes.
- get_pagination not working on a custom post type query (using WP_Query)
- WP_Query with custom post type ID
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Different options per post type in WP_Query
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- Custom Post Type not showing in main loop
- My custom taxonomy is only displaying 1 of 3 terms
- postsperpage value not being applied
- Exclude latest post from WP_Query taxonomy term loop
- Display the current post in browser as the first post in a loop (for a slideshow)
- How to query Posts from a custom post type which contains a custom taxonomy?
- Sorting the Loop by Taxonomy Value
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- custom taxonomy pagination 404 error
- Custom archive page for custom taxonomy and pagination issue
- Ordering by meta value not working
- Pagination Not Working When Used With WP_Query() `offset` Property
- Excluded Custom Taxonomy Term Posts Displaying in loop
- Some posts not displaying by taxonomy term
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Query a custom taxonomy in a function to create an csv file
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- subtracting the current post form then whole loop, which is generating all CPT titles
- Mix Facebook and Twitter feed into custom posts
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Strange behavior on WP_query
- Custom taxonomy page template
- Get posts associated with custom taxonomy alternate way
- display news with pictures 3 small and one large (loop)
- WordPress Custom Post Type and sort by Tags
- How to display elements of different post types?
- Sorting custom post types by taxonomy (So close)
- Looping taxonomy in taxonomy?
- Attaching multiple custom taxonomies to one CPT?
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- Create a WordPress loop that shows posts from a custom post type + filters the posts by taxonomies while hiding empty taxonomies
- Add Custom Taxonomy Terms as CSS Classes for CPT Posts in an Elementor Loop Item Template