我收到一个奇怪的错误-
特定自定义帖子类型(仅适用于该帖子)的帖子列表中出现白色屏幕
- 尝试停用所有插件
- 尝试检查错误(调试= true)
页面仍然没有回声什么……(源代码中也没有)
我在管理员中谈论的是这样的网址:http : //www.example.co.il/wp-admin/edit.php? post_type=
submodelscpt
这是我正在使用的register_post_type部分:
function register_submodelcpt() {
$labels = array(
'name' => __('Sub Models', THEME_NAME),
'singular_name' => __('Sub Models', THEME_NAME),
'add_new' => __('New Model', THEME_NAME),
'add_new_item' => __('Add new Model', THEME_NAME),
'edit_item' => __('Edit Model', THEME_NAME),
'new_item' => __('New Model', THEME_NAME),
'all_items' => __('All Sub Models', THEME_NAME),
'view_item' => __('Watch Model', THEME_NAME),
'search_items' => __('Search Models', THEME_NAME),
'not_found' => __('No Models found', THEME_NAME),
'not_found_in_trash' => __('No Models found in trash', THEME_NAME),
'parent_item_colon' => '',
'menu_name' => __('Sub Models', THEME_NAME),
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array('slug' => 'submodels'),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => 5,
'menu_icon' => get_stylesheet_directory_uri().'/images/cpt/subcars.png',
'supports' => array('title', 'thumbnail', 'revisions', 'page-attributes')
);
register_post_type('submodelscpt',$args);
}
add_action('init', 'register_submodelcpt');
有人遇到过这样的问题吗?
您能想到发生这种情况的原因吗?
当我更改此设置时,另一个奇怪的事情是:http :
//www.example.co.il/wp-admin/edit.php?post_type=submodelscpt
为此:http :
//www.example.co.il/wp-admin/edit.php?post_type=submodelscpt&orderby=date&order=desc
帖子列表已正确加载...
pre_get_posts
。但是,如果调试处于活动状态,并且白屏没有错误,我认为必须存在exit
或die
,请尝试搜索它们。
pre_get_posts
查询的内容