tjldesigns on "[Plugin: Custom Post Type UI] Querying custom post type only"

ساخت وبلاگ

Hi Michael,

Thanks so much for getting back :).

Yes both of those taxonomies are attached to the custom post type "lawyers" and to general posts too. And I think this seems to be where the issue is cropping up... As if I change the query to :

'post_type' => 'lawyers',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array( 'relation' => 'AND', array( 'relation' => 'OR', array( 'taxonomy' => 'services', 'field' => 'slug', 'terms' => $tax_sectors_slugs, ), array( 'taxonomy' => 'expertise', 'field' => 'slug', 'terms' => $tax_practices_slugs, ), ),
),

Basically just adding that extra nested array with 'relation' => 'AND', it then works perfectly.

SImilarily, if I remove all taxonomy querying, then it only shows me "lawyers" no general posts.

But the point remains that I think my original query should just work as is shouldn't it as I've used this before on other sites and it has worked I'm pretty sure... ie :

$wpbp = new WP_Query(array( 'post_type' => 'lawyers', 'posts_per_page' =>'-1', 'orderby' => 'title', 'order' => 'ASC', 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'services', 'field' => 'slug', 'terms' => $tax_sectors_slugs, ), array( 'taxonomy' => 'expertise', 'field' => 'slug', 'terms' => $tax_practices_slugs, ), ),
) );

What do you think?

Also sorry I updated the -1 thank you, and just to confirm nothing in the theme is overriding or affecting the queries.

Many thanks :)

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 199 تاريخ : شنبه 19 تير 1395 ساعت: 16:14