Problem with get_posts, tax_query and counting the number of posts

Try this again removing operator and relation arguments as follows: here is a useful link http://ottopress.com/2010/wordpress-3-1-advanced-taxonomy-queries/ $products = get_posts(array( ‘post_type’ => ‘products’, ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘collection’, ‘field’ => ‘slug’, ‘terms’ => array($current_collection) ), array( ‘taxonomy’ => ‘type’, ‘field’ => ‘slug’, ‘terms’ => array($current_type) ), array( ‘taxonomy’ … Read more

Specify number of posts in my ‘tax_query’

Never user query_posts, under any circumstances. Use WP_Query instead, which is how query_posts works internally, but without the trickery and downsides. You’ll also find that the WP_Query documentation gives you explanations for every parameter, including what you are trying to do: posts_per_page (int) – number of post to show per page (available with Version 2.1, … Read more

Tax_query not working on multisite

I found out that in order to query wp posts via custom taxonomy, from a blog 1 to another blog 2, you have to register that custom taxonomy in both blogs, otherwhise it won’t work. this is strange but true! anyways it works fine now.

Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)

This is a really interesting question, which can result in a very expensive, resource intensive process which can really slow your page down dramatically PRELUDE All my code in this question is based on the following post type and taxonomy, so before you run any code, make sure to adjust the post type and taxonomy … Read more