经过几次搜索,也许没有正确的英语术语,我来这里寻找我问题的答案。
我在我的网站上创建了一个主题,在过去的6个月里,一切都很顺利。
我还有一个自定义的帖子类型,可以在我的网站上添加一些twitch频道并显示它们。
昨天,我创建了一个新的自定义帖子类型来写一些快速新闻,所以只需要最简单的内容:标题、内容、作者和修订。
但当我把这个添加到我的网站上时,帖子、流、新闻和页面列表变为空,并显示“未找到”消息,即使有一些此类帖子的内容。
像这样:
我想我很久以前就有这个bug了,但我不记得怎么修复它了。
我试图一个接一个地取消激活我的每个插件,但bug仍然存在。
以下是我自定义帖子类型的代码(使用GenerateWP创建以节省大量时间):
if ( ! function_exists(\'news_post\') ) {
function news_post() {
$labels = array(
\'name\' => _x( \'News\', \'Post Type General Name\', \'text_domain\' ),
\'singular_name\' => _x( \'News\', \'Post Type Singular Name\', \'text_domain\' ),
\'menu_name\' => __( \'News\', \'text_domain\' ),
\'name_admin_bar\' => __( \'News\', \'text_domain\' ),
\'archives\' => __( \'Item Archives\', \'text_domain\' ),
\'parent_item_colon\' => __( \'Parent News:\', \'text_domain\' ),
\'all_items\' => __( \'All News\', \'text_domain\' ),
\'add_new_item\' => __( \'Add New News\', \'text_domain\' ),
\'add_new\' => __( \'Add News\', \'text_domain\' ),
\'new_item\' => __( \'New News\', \'text_domain\' ),
\'edit_item\' => __( \'Edit News\', \'text_domain\' ),
\'update_item\' => __( \'Update News\', \'text_domain\' ),
\'view_item\' => __( \'View News\', \'text_domain\' ),
\'search_items\' => __( \'Search News\', \'text_domain\' ),
\'not_found\' => __( \'Not found\', \'text_domain\' ),
\'not_found_in_trash\' => __( \'Not found in Trash\', \'text_domain\' ),
\'featured_image\' => __( \'Featured Image\', \'text_domain\' ),
\'set_featured_image\' => __( \'Set featured image\', \'text_domain\' ),
\'remove_featured_image\' => __( \'Remove featured image\', \'text_domain\' ),
\'use_featured_image\' => __( \'Use as featured image\', \'text_domain\' ),
\'insert_into_item\' => __( \'Insert into News\', \'text_domain\' ),
\'uploaded_to_this_item\' => __( \'Uploaded to this News\', \'text_domain\' ),
\'items_list\' => __( \'News list\', \'text_domain\' ),
\'items_list_navigation\' => __( \'News list navigation\', \'text_domain\' ),
\'filter_items_list\' => __( \'Filter News list\', \'text_domain\' ),
);
$args = array(
\'label\' => __( \'News\', \'text_domain\' ),
\'description\' => __( \'News Post Type\', \'text_domain\' ),
\'labels\' => $labels,
\'supports\' => array( \'title\', \'editor\', \'author\', \'revisions\', ),
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 5,
\'show_in_admin_bar\' => true,
\'show_in_nav_menus\' => true,
\'can_export\' => true,
\'has_archive\' => true,
\'exclude_from_search\' => false,
\'publicly_queryable\' => true,
\'capability_type\' => \'post\',
);
register_post_type( \'post_type\', $args );
}
add_action( \'init\', \'news_post\', 0 );
}
你知道怎么解决吗?