You need to use the methods of your query instance, rather than the global functions (which are merely wrappers for the global $wp_query
):
if ( $query->have_posts() ) {
$term = $query->queried_object;
while ( $query->have_posts() ) : $query->the_post();
//Output my posts
the_title();
the_content();
endwhile;
}
Related Posts:
- query multiple taxonomies
- Querying Posts by Taxonomy From Alternate Network Site
- Sort the main query in subcategories/terms?
- WP_Query search posts by custom post type and custom taxonomy
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Querying Term Posts in Loop
- Filtering WP_Query Dynamically on the Front-End
- Search / Filter posts on Title/Content OR Tags
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- First custom field value (out of several) displayed twice after query
- WP_Query orderby and tax_query
- WP_Query() with custom post type and taxonomy — get all terms?
- Query custom posts from custom taxonomy
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- display post count in archive page that have relation with another taxonomy term
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Display all Custom taxonomy terms and their relevant custom posts
- Query Pulling the same post twice
- How to pass taxonomy terms to WP_Query along with $args?
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- Display all posts in a custom post type, grouped by a custom taxonomy
- How to use a custom post type as front page?
- Custom Taxonomy with Custom Post Type Finds No Posts
- Custom Taxonomies Terms as Post Title for Custom Post Types upon Publishing
- Retrieve single term slug
- Custom query – alternate posts by category
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- How can I add programmatically custom taxonomy terms to a custom type post when saving posts?
- post count is wrong when using same taxonomy for 2 different CPT
- how to group custom post type posts by custom taxonomy terms
- SQL to update custom post taxonomies
- Query multiple taxonomy in Custom Post Type
- Separate Custom Post Type Taxonomy by Comma
- Query by 2 values of a repeater ACF field
- Get child terms of current term of the current post
- Comparing timestamps in meta query doesn’t work
- Include both default and Custom Post Type in query modified inside pre_get_posts
- Multiple Archive Pages for Custom Post Types AND Taxonomies
- List all custom post type posts from a given category?
- 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
- Custom Query to display posts with custom field
- Get taxonomy description based on variable
- Conditional to modify query results
- How to check the terms in single custom post type template
- Filter by custom taxonomy slug on a custom post type
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Am unable to reset a query properly
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Get next and previous 3 posts in a term in single post page
- using $wpdb to get custom post type with term
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Allow user to set custom order to a list of custom taxonomies?
- Custom-Posttype & Custom Taxonomy WP_Query
- Which post does a taxonomy term belongs to?
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- How do I require the specification of term in a custom post type and custom taxonomy?
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- Retrieve custom post types by custom taxonomies with WP_Query
- Using page slug in wp_query
- Custom taxonomy wp_query woes.
- How to Display Posts From Category Within a Custom Taxonomy?
- 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
- Exclude latest post from WP_Query taxonomy term loop
- How to query Posts from a custom post type which contains a custom taxonomy?
- Create query for both custom post type and category
- How can I get 3 different taxonomy type terms in a div class element?
- Custom taxonomy query showing more than 4 posts
- Get terms for a specfic post from multiple taxonomies in custom post type
- Query Custom Post by taxonomy multiple categories
- Display featured posts for a custom post type by taxonomy
- Get_the_term_list inexplicably adds values in foreach
- What is the most efficient way to execute recursive complex queries?
- custom taxonomy pagination 404 error
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- Excluded Custom Taxonomy Term Posts Displaying in loop
- Get all posts for custom taxonomy term
- posts_per_page is not working by term
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Add active class to foundation 6 tabs while looping categories
- Saving Child Terms on front end not setting parent
- Filter By Term Not Working – Custom Post Type
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Get posts associated with custom taxonomy alternate way
- Get list of CPT posts in *current* post’s taxonomy term
- Loop with Custom Post Type and Taxonomies
- Exclude Custom Post Type from shared Custom Taxonomy
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Get a list of categories ids
- How to display elements of different post types?
- get_the_term_list() wanting to loop through the returned values
- Attaching multiple custom taxonomies to one CPT?
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- Load posts via AJAX without draft status
- WP Query – Can’t get posts with specific taxonomy