自定义帖子类型的分类查询不显示结果。定期查询自定义类型显示结果。我可以将自定义税赋分配给自定义类型。当我运行查询时,我什么也得不到,只是一个错误。我得到这个错误:wordpress - WP查询自定义类型/税不显示帖子
Notice: Undefined offset: 0 in /Applications/MAMP/htdocs/folsom/wp-includes/query.php on line 2526
这里是我的查询:
$args = array(
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'product-cat',
'term' => 'featured',
'field' => 'slug'
)
)
);
**更新:命中进入我做了。我在添加更多信息的过程中
**更新:我确保将分类法添加到参数类型的参数中,定义了优先级,以便他们首先注册。
add_action('init', 'create_product_taxonomies', 0);
add_action('init', 'setup_custom_post');
function setup_custom_post(){
$args = array(
'label' => 'products',
// Bunch of other stuff
'taxonomies' => array('product-cat'),
),
);
register_post_type('product', $args);
}
你要添加其他内容? – 2014-09-01 02:40:59