Querying with WP_Query getting 0 = 1
-
If a access /media_category/clients/ I get the images tagued with “clients” term, but if I try:
$posts = new WP_Query([
'post_type' => 'attachment',
'post_status' => 'any',
'tax_query' => array(
array(
'taxonomy' => 'media_category',
'field' => 'slug',
'terms' => 'clients'
)
)
]);
I get this query: “SELECT SQL_CALC_FOUND_ROWS rs_posts.ID FROM rs_posts LEFT JOIN rs_posts AS p2 ON (rs_posts.post_parent = p2.ID) WHERE 1=1 AND (
0 = 1
) AND rs_posts.post_type = ‘attachment’ AND (((rs_posts.post_status <> ‘trash’ AND rs_posts.post_status <> ‘auto-draft’) OR (rs_posts.post_status = ‘inherit’ AND (p2.post_status <> ‘trash’ AND p2.post_status <> ‘auto-draft’)))) GROUP BY rs_posts.ID ORDER BY rs_posts.post_date DESC LIMIT 0, 10″I found a reference here (https://wordpress.stackexchange.com/questions/56034/using-tax-query-creates-a-1-0-or-1-1-in-wp-query-request) about that 0 = 1 in the middle of the query.
Any help?
- The topic ‘Querying with WP_Query getting 0 = 1’ is closed to new replies.