我想獲得帖子,與自定義帖子類型和分類。我試着用這個代碼:WordPress的wp_query post_type和分類不起作用
$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?我認爲問題在這裏。我能如何解決?