你好,我有两种自定义的帖子类型,分别是“漫画”和“博伦”。我可以在“漫画”帖子类型上搜索帖子,但当我尝试在“bolum”帖子类型上搜索时,我会从“漫画”中得到结果,如果我尝试第二次搜索,则会显示一个错误页面,如“无效帖子类型”。
这是我在函数中自定义的帖子类型代码。php
function register_bolumpost() {
$labels = array(
\'name\' => _x( \'Bölümler\', \'my_custom_post\',\'custom\' ),
\'singular_name\' => _x( \'Bölüm\', \'my_custom_post\', \'custom\' ),
\'all_items\'=> _x( \'Tüm Bölümler\', \'my_custom_post\', \'custom\' ),
\'add_new\' => _x( \'Yeni Ekle\', \'my_custom_post\', \'custom\' ),
\'add_new_item\' => _x( \'Yeni Bölüm Ekle\', \'my_custom_post\', \'custom\' ),
\'edit_item\' => _x( \'Bölümü Düzenle\', \'my_custom_post\', \'custom\' ),
\'new_item\' => _x( \'Yeni Bölüm\', \'my_custom_post\', \'custom\' ),
\'view_item\' => _x( \'Bölümü Görüntüle\', \'my_custom_post\', \'custom\' ),
\'search_items\' => _x( \'Bölüm Ara\', \'my_custom_post\', \'custom\' ),
\'not_found\' => _x( \'Bölüm Bulunamadı\', \'my_custom_post\', \'custom\' ),
\'not_found_in_trash\' => _x( \'Çöp Kutusunda Bölüm Bulunamadı\', \'my_custom_post\', \'custom\' ),
\'parent_item_colon\' => _x( \'Bölüm\', \'my_custom_post\', \'custom\' ),
\'menu_name\' => _x( \'Bölümler\', \'my_custom_post\', \'custom\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'description\' => \'Bölüm Postu\',
\'supports\' => array( \'title\', \'editor\', \'comments\'),
\'taxonomies\' => array(\'mangalar_cat\'),
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 7,
\'show_in_nav_menus\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false,
\'query_var\' => true,
\'can_export\' => true,
\'public\' => true,
\'has_archive\' => true,
\'capability_type\' => \'post\'
);
register_post_type( \'bolum\', $args );
}
add_action( \'init\', \'register_bolumpost\');
add_post_type_support( \'bolum\', \'post-formats\' );
function register_mangapost() {
$labels2 = array(
\'name\' => _x( \'Mangalar\', \'my_custom_post2\',\'custom2\' ),
\'singular_name\' => _x( \'Manga\', \'my_custom_post2\', \'custom2\' ),
\'all_items\'=> _x( \'Tüm Mangalar\', \'my_custom_post2\', \'custom2\' ),
\'add_new\' => _x( \'Yeni Ekle\', \'my_custom_post2\', \'custom2\' ),
\'add_new_item\' => _x( \'Yeni Manga Ekle\', \'my_custom_post2\', \'custom2\' ),
\'edit_item\' => _x( \'Mangayı Düzenle\', \'my_custom_post2\', \'custom2\' ),
\'new_item\' => _x( \'Yeni Manga\', \'my_custom_post2\', \'custom2\' ),
\'view_item\' => _x( \'Mangayı Görüntüle\', \'my_custom_post2\', \'custom2\' ),
\'search_items\' => _x( \'Manga Ara\', \'my_custom_post2\', \'custom2\' ),
\'not_found\' => _x( \'Manga Bulunamadı\', \'my_custom_post2\', \'custom2\' ),
\'not_found_in_trash\' => _x( \'Çöp Kutusunda Manga Bulunamadı\', \'my_custom_post2\', \'custom2\' ),
\'parent_item_colon\' => _x( \'Manga\', \'my_custom_post2\', \'custom2\' ),
\'menu_name\' => _x( \'Mangalar\', \'my_custom_post2\', \'custom2\' ),
);
$args2 = array(
\'labels\' => $labels2,
\'hierarchical\' => false,
\'description\' => \'Manga Postu\',
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', \'comments\' ),
\'taxonomies\' => array( \'durum_cat\', \'turler_cat\', \'mangalar_cat\'),
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 4,
\'show_in_nav_menus\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false,
\'query_var\' => true,
\'can_export\' => true,
\'public\' => true,
\'has_archive\' => true,
\'capability_type\' => \'post\'
);
register_post_type( \'manga\', $args2 );
}
add_action(\'init\', \'register_mangapost\');
add_post_type_support( \'manga\', \'post-formats\' );
这是我的全部功能。php,如果需要的话。
https://paste.ee/p/wtdsz