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);