我正在尝试通过主题或插件注册所有自定义帖子类型,但没有任何方法有效。
$postargs = array(
\'public\' => true,
\'_builtin\' => false
);
$postoutput = \'names\';
$postoperator = \'and\';
$post_types = get_post_types( $postargs, \'names\', \'and\' );
/// Main Loop Start
foreach ($post_types as $post_type){
//and then i want to Get all the Custom Taxonomies for those post types in a loop
$taxonomies = get_object_taxonomies(\'$post_type\', \'objects\');
// Loop
foreach ($taxonomies as $taxonomy){
// Do Stuff with taxonomy
} // Loop
} /// Main Loop Ends
But the problem is only WordPress Defaults Post Types are showing up if i do
\'_builtin\' => true
发布第页附件
这是注册帖子类型的代码我没有任何帖子类型,我目前在主题中有8个自定义帖子类型。该帖子已使用此代码注册。。。
$args = array(
\'labels\' => array(
\'name\' => __( \'Faq\', \'yit\' ),
\'singular_name\' => __( \'Faq\', \'yit\' ),
\'plural_name\' => __( \'Faqs\', \'yit\' ),
\'item_name_sing\' => __( \'Faq\', \'yit\' ),
\'item_name_plur\' => __( \'Faqs\', \'yit\' ),
\'add_new\' => __( \'Add New Faq\', \'yit\' ),
\'add_new_item\' => __( \'Add New Faq\', \'yit\' ),
\'edit\' => __( \'Edit\', \'yit\' ),
\'edit_item\' => __( \'Edit Faq\', \'yit\' ),
\'new_item\' => __( \'New Faq\', \'yit\' ),
\'view\' => __( \'View Faq\', \'yit\' ),
\'view_item\' => __( \'View Faq\', \'yit\' ),
\'search_items\' => __( \'Search Faqs\', \'yit\' ),
\'not_found\' => __( \'No Faqs\', \'yit\' ),
\'not_found_in_trash\' => __( \'No Faqs in the Trash\', \'yit\' ),
),
\'hierarchical\' => false,
\'public\' => true,
//\'menu_position\' => 30,
//\'icon_menu\' => ,
\'has_archive\' => \'faq\',
\'rewrite\' => array( \'slug\' => apply_filters( \'yit_faqs_rewrite\', \'faq\' ) ),
\'supports\' => array( \'title\', \'editor\', \'cats\'),
\'description\' => "Faq"
);
register_post_type(\'faq\', $args);