我添加了一个自定义类型的自定义帖子类型。当我想通过菜单导航到分类法时,我的完整网站就崩溃了。我的自定义分类中的某些类别使用与我的帖子相同的名称,但我不认为这是问题。关于我在这里做错了什么的任何想法?
add_action('init', 'ptu_create_post_types');
function ptu_create_post_types() {
register_taxonomy('hotel-taxonomy', 'hotel',
array( 'hierarchical' => true,
'label' => 'Destinations',
'singular_label' => 'Destination',
'rewrite' => array('slug' => 'hotels', 'with_front' => false),
'public' => true,
'show_ui' => true,
'show_tagcloud' => true,
'_builtin' => true,
'show_in_nav_menus' => true));
register_post_type('hotel',
array('labels' => array(
'name' => __('Hotels'),
'singular_name' => __('Hotel'),
'add_new' => __('Add new hotel'),
'edit_item' => __('Edit hotel'),
'new_item' => __('New hotel'),
'view_item' => __('View hotel'),
'search_items' => __('Search hotels'),
'not_found' => __('No hotels found'),
'not_found_in_trash' => __('No hotels found in trash')),
'public' => true,
'supports' => array('title', 'editor', 'post-formats')
));
}
答案 0 :(得分:0)
我一遍又一遍地测试/调试了一切,最后发现实际上并没有这段代码被破坏,而是一个自定义的摘录函数由于某种原因卡在了一个while循环中(它只发生在自定义分类法)。错误日志虽然没有显示任何内容,所以当我弄清楚发生了什么时......