我只想删除Comment\'s column 在里面all post-types 在一个single function
My current function , Have to do each post-type like this :
function remove_post_columns($columns) {
unset($columns[\'comments\']);
return $columns;
}
add_filter(\'manage_edit-post_columns\',\'remove_post_columns\',10,1);
function remove_page_columns($columns) {
unset($columns[\'comments\']);
return $columns;
}
add_filter(\'manage_edit-page_columns\',\'remove_page_columns\',10,1);
Possible to do in a single function 对于未来的职位类型?
最合适的回答,由SO网友:l2aelba 整理而成
I got an alternative :
这不仅会隐藏,还会禁用function disable_comments() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if(post_type_supports($post_type,\'comments\')) {
remove_post_type_support($post_type,\'comments\');
remove_post_type_support($post_type,\'trackbacks\');
}
}
}
add_action(\'admin_init\',\'disable_comments\');