我在使用query_posts的wordpress中遇到問題。如何使用類別ID獲取wordpress文章?
這裏是我的代碼:
$args = array('category__in' => array(9),'post_type'=>'banner-slider','post_status'=>'publish');
query_posts($args);
while (have_posts()) : the_post();
the_title();
endwhile;
query_post回報以下查詢:
SELECT SQL_CALC_FOUND_ROWS bib_posts.* FROM bib_posts WHERE 1=1 AND 0 = 1 AND bib_posts.post_type = 'banner-slider' AND ((bib_posts.post_status = 'publish')) GROUP BY bib_posts.ID ORDER BY bib_posts.post_date DESC LIMIT 0, 10
在上面的查詢,我得到0 = 1,這是錯誤的。但是當我從查詢文章中刪除category__in然後我的查詢工作正常。
請告訴我我錯在哪裏。