我有一个“actor”cpt,它似乎会自动添加到查询中:
SELECT object_id, term_taxonomy_id
FROM wp_term_relationships INNER JOIN wp_posts ON object_id = ID
WHERE term_taxonomy_id IN (38,40,30,11,32,34,29,39,35,9,31,19,33,37,42,41,27,25,36,1,26)
AND post_type IN (\'post\', \'actor\')
AND post_status = \'publish\'
Call from: require, require_once, include, get_sidebar, get_template_part, locate_template, load_template, require, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Categories->widget, wp_list_categories, get_categories, get_terms, _pad_term_counts
(使用
Debug Queries 插件)
这就是CPT的定义:
register_post_type(\'actor\', array(
\'public\' => true,
\'labels\' => $labels,
\'has_archive\' => \'actors\',
\'taxonomies\' => array( \'category\' )
));