I think showposts
was replaced by posts_per_page
in wordpress 2.1. See pagination parameters. Also note that print_r($query)
won’t return any results because $query variables is WP_Query object; you need to exceute the query.
$args = array(
'post_type' => 'contractors',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'terms' => $taxarray,
'field' => 'id'
)
)
);
$query = new WP_Query($args);
$results = $query->get_posts();
print_r($results);
Related Posts:
- Taxonomy: Why ‘with_front’ => false DOES NOT WORK?
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Assign posts to taxonomy terms instead of the taxonomy terms to posts?
- Exclude from search all custom posts which are NOT in a taxonomy term
- Custom SQL Query on Custom Post Type. Order by Taxonomy?
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- Paginated Taxonomy Term Archive including one post per term
- $wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies
- Get posts by querying taxonomy and certain terms of the taxonomy?
- Custom post type templating problem
- Custom Post Type Taxonomy Filters
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How to conditionally redirect to the post from a taxonomy page?
- How to group posts and get a mixed posts and groups view?
- How to list tags from custom post type attachments?
- How to get_term_meta on single custom post?
- I have custom post type with custom taxonomy. But not found the taxonomy page..
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Single.php for Custom Post Type > Taxonomy > Term
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- ACF – Retrieve custom taxonomy from a relationship field
- Display Custom Field or Custom Taxonomy in front page /post/product
- WP_Query not using custom taxonomy categories on custom post type
- Showing taxonomies with terms that are attached to custom post
- Getting all custom post taxonomies and exhibiting only part of them
- Error get_posts with Custom Taxonomy and OR relation
- Get list of CPT posts in *current* post’s taxonomy term
- tax_query showing no results
- Linking custom taxonomies and posts
- Storing/querying custom date data
- How to Add Custom Taxonomy To Woocommerce Plugin
- Check if post type has term
- Custom taxonomy not showing up when adding a new custom post type
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Create an archive page for custom taxonomies
- Rewrite permalinks for custom posttype and custom taxonomy
- How to check if last uri segment is a custom post type or taxonomy term?
- Categories under custom post types doesn’t show properly
- Sort the main query in subcategories/terms?
- Highlight nav menu terms
- Custom Post Types, Custom Taxonomies and Permalinks ?
- get a list of posts from Custom Taxonomy
- Trying to manage templates on a blog with lots of custom taxonomies
- Display Custom Category (taxonomy) Name in Custom Post Type
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Custom post type and taxonomy permalinks – Structure
- Best action hook to create custom post and assign taxonomy terms to it on plugin activation?
- Custom Post Types relationships
- How many Custom Post Types to register?
- How can i skip same post from taxonomy term?
- Set menu active state for custom posttype and category, given custom taxonomy term
- How to bulk copy custom fields between custom posts?
- Custom post type structure for posts with multiple child posts
- Search / Filter posts on Title/Content OR Tags
- List custom taxonomy specific to one custom post type
- Hide parent categories when clicked, and show it’s childs
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- Auto Complete Search
- permalink /category/post-name with custom post type and taxonomy
- Displaying Custom Taxonomies From Multiple Custom Post Types
- Display and register custom categories for custom post types
- Properly flush rewrite rules on plugin activation
- Adding predefined terms to a taxonomy
- Redirect to archive is single post has a certain term assigned to it?
- Custom query – get_the_terms not work
- Displaying tags associated with posts in Custom Post Type
- Custom taxonomy page returns 404
- portfolio custom type tags support
- Custom taxonomies to define versions of a product
- How to select a template for a custom post type?
- Targeting custom post type via functions.php doesn’t work
- Add filter to Admin list for all custom post types by their custom taxonomies
- Displaying custom taxonomy menu in custom post type archive
- Custom post types templates
- prevent sub categories to show up
- Custom post type category link redirecting to 404 page
- Archive page URL for custom taxonomy and post type
- Custom Post Type Archive Page showing as 404
- Custom taxonomy terms hierarchical navigation
- Create custom post type categories
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- How to get post type archive category title
- Remove CPT Slug with 2 taxonomies and 1 post meta
- Should I make a taxonomy to organize data like this?
- Associate custom categories to different user IDs
- archive-{custom_post_type}.php not getting recognized wordpress
- How to retrieve the permalink for a specific (custom) term?
- Values inside a custom field to determine which category posts to display
- changing post type in loop query
- Taxonomy and Rewrite Structure
- Pagination for a Custom Taxonomy
- Trying to create hierarchy between 3-4 custom post types
- Only One Post of Custom Post Type Appearing on Template Page
- Code to show related posts (custom post type and custom taxonomy/category) is messing with other code
- register_term_meta not working
- Show custom category archive as front page and remove taxonomy slug from urls