我将把这个答案的第一个版本留在底部,因为它可能有用。
no way 以分层方式组织该列。解决方案是制作一个自定义列并使用这个Codex snippet:
// Change "post_" for the desired post type
add_filter( 'manage_edit-post_columns', 'custom_categories_register_so_15813936', 20, 1 );
add_action( 'manage_post_posts_custom_column', 'custom_categories_display_so_15813936', 20, 2 );
function custom_categories_register_so_15813936( $columns )
{
$columns[ 'custom-cat' ] = 'Categories';
return $columns;
}
function custom_categories_display_so_15813936( $column_name, $post_id )
{
if ( 'custom-cat' != $column_name )
return;
// get the category IDs assigned to post
$categories = wp_get_post_categories( $post_id, array( 'fields' => 'ids' ) );
// separator between links
$separator = ', ';
if ( $categories ) {
$cat_ids = implode( ',' , $categories );
$cats = wp_list_categories( 'title_li=&style=none&echo=0&include=' . $cat_ids );
$cats = rtrim( trim( str_replace( '<br />', $separator, $cats ) ), $separator );
$cats = str_replace( site_url('category/'), admin_url('edit.php?category_name='), $cats );
echo str_replace( '/" title', '" title', $cats );
}
}
左侧为默认列,右侧为自定义列。
[第一个版本]
我想您是在谈论后端 (/wp-admin)。您看到的行为是 WordPress 默认的。要摆脱那个“功能”,你需要插件Category Checklist Tree:
在帖子编辑屏幕上,保存帖子后,您会注意到
选中的类别显示在顶部,打破了类别
等级制度。这个插件删除了那个“功能”。
此外,它会自动滚动到第一个选中的类别。
也适用于自定义分类法。