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 Dynamically Filter Custom Post Types by Taxonomy Based on URL in Elementor Pro and ACF?
- set permalink for CPT
- Top Level pages in wordpress giving 404, but child pages working fine
- Sitemap generation
- Plugin fatal error
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy/Custom post type structure suggestion on a movie site
- Search by tag name and category
- Taxonomy in URL
- Ordering values entered in Custom Taxonomies
- Listing all term items alphabetically / sorting loop
- How to produce a sub-page-system in WordPress
- Change the Custom Taxonomy URL Slug pattern
- can these 3 queries be re-written as 1 query?
- Advanced search form with filters for custom taxonomies
- Custom taxonomy and post type with same slug
- Losing Nav Active State in Menu
- WordPress custom taxonomy template not working
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- Listing custom terms in custom post meta
- Show fields based on taxonomy selection in editor
- Display related custom taxonomy posts in sidebar
- WordPress subpages to custom post types
- Different rewrite rules for taxonomies and cp in multisite?
- Permalinks: custom structure for taxonomy – tags?
- count results in search page based on custom category
- Custom permalink with child taxonomy terms
- Assign Custom post to Custom Taxonomy
- Custom post type Permalinks with hierarchical Taxonomies
- Display Registered Taxonomies
- How can I get this request to use the Custom Post Type page template instead?
- Include custom taxonomy term in search
- Show custom post type inside a custom post type
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- Create a permalink structure with custom taxonomies and custom post types gives 404
- Display and register custom categories for custom post types
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Different Category system needed for the Custom Post Type
- Not Able To Render Single-CustomPostType.php File
- Custom Post Type Category Link
- Retrieve custom post types by custom taxonomies with WP_Query
- Custom Post type category pages template and loop
- Archive for a Taxonomy of a Custom Post type
- Three Most Recent Posts, One Per Term
- Check if post has specific tag_ID in custom post type
- How to get WordPress term attached to the Post?
- Query posts with double taxonomy
- Custom Post Archive is not working
- Custom post type pagination 404
- get_the_title() is returning results from previous loop
- Why cant I add a custom post type to a custom taxonomy?
- Show Custom Taxonomy title in loop
- WP the_posts() on single-cars.php get category link
- tax_query not working in template
- Trick to get custom post types to show up on a custom taxonomy page?
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- How to add custom taxonomy in custom post type permalink?
- single-{post_type}.php not working
- Properly flush rewrite rules on plugin activation
- Adding predefined terms to a taxonomy
- How to solve this custom post type goes to 404 page?
- Get term name without a foreach loop
- Show all tags on custom post type
- Template to list categories in custom taxonomy
- How to Set Taxonomy Object Description?
- Best way to specify “article type” in URL
- How do I add a Custom Post Type that looks and behaves exactly the same as Posts?
- custom post type vs. conditionally displaying meta boxes for specific terms?
- Is there something like has_no_term