我正在尝试使用自定义帖子类型和分类来获取帖子。我尝试使用以下代码:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'specification',
'tax_query' => array(
array(
' taxonomy' => 'model',
'field' => 'slug',
'term' => 'grand-cherokee-2013'
)
),
'order' => 'ASC',
'paged' => $paged
);
$wp_query = new WP_Query( $args );
和:
global $wp_query;
query_posts( array(
'post_type' => 'specification',
'category_name' => 'model',
'showposts' => '10' )
);
我做了 print_r($wp_query),请求是:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND 0 = 1 AND wp_posts.post_type = 'specification' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
为什么 wordpress 加 0 = 1?我认为问题就在这里。我该如何解决?