以下回答了其中一些问题:Set Default Admin Screen options & Metabox Order
要删除permalink元盒,请执行以下操作:
function my_remove_meta_boxes() {
remove_meta_box(\'slugdiv\', \'my-post-type\', \'core\');
}
add_action( \'admin_menu\', \'my_remove_meta_boxes\' );
此外,您还必须使用css或javascript隐藏#edit slug box。请参见:
Loading External Scripts in Admin but ONLY for a Specific Post Type?要禁用快速编辑,请执行以下操作:
function my_remove_actions( $actions, $post ) {
if( $post->post_type == \'my-post-type\' ) {
unset( $actions[\'inline hide-if-no-js\'] );
}
return $actions;
}
add_filter( \'post_row_actions\', \'my_remove_actions\', 10, 2 );
要更改预览链接,可以使用过滤器“preview\\u post\\u link”,但它仅在帖子尚未发布时有效。因此,解决方案是删除提交元框并添加您自己的修改元框:
function my_replace_submit_meta_box() {
remove_meta_box(\'submitdiv\', \'my-post-type\', \'core\');
add_meta_box(\'submitdiv\', __(\'Publish\'), \'custom_post_submit_meta_box\', \'my-post-type\', \'side\', \'core\');
}
add_action( \'admin_menu\', \'my_replace_submit_meta_box\' );
function custom_post_submit_meta_box() { // a modified version of post_submit_meta_box() (wp-admin/includes/meta-boxes.php, line 12)
...
}