0%

后台文章列表中添加自定义栏目

例如添加Slug栏目

1
2
3
4
5
6
7
8
9
10
11
12
add_filter('manage_posts_columns', 'add_slug_col');
function add_slug_col($cols){
$cols['slug'] = __('Slug');
return $cols;
}
add_action('manage_posts_custom_column', 'get_slug_show');
function get_slug_show($column_name){
if($column_name == 'slug'){
$get_slug = basename(get_permalink(get_the_ID()));
echo $get_slug;
}
}