Can I change the default admin for wordpress pages?
I know I can modify what default data entry areas show up when I make a custom post type, but is there a way to modify the default "pages" data entry -- for example, say I'd like to only provide the title and main text boxes.
For a custom post type, I'd use 'supports' => array('title, 'editor')
but I'm unsure as to how to apply th开发者_JS百科is type of change to the "pages" interface.
Hope I'm asking this clearly, as I'm a bit new to WP.
You'll have to edit core code. The default post types are registered in wp-includes/post.php
in a function called create_initial_post_types
, kick it from there.
Drop this into your theme's functions.php file.
Comment/Uncomment what you need — it lets you remove items independently for posts and pages.
(I haven't tested it on an install that uses custom post types, but I'm assuming it will play nice.)
function unused_meta_boxes() {
//remove_meta_box('commentstatusdiv','post','normal'); // Comment Status
remove_meta_box('commentstatusdiv','page','normal'); // Comment Status
//remove_meta_box('postexcerpt','post','normal'); // Excerpt
remove_meta_box('postexcerpt','page','normal'); // Excerpt
//remove_meta_box('authordiv','post','normal'); // Author
remove_meta_box('authordiv','page','normal'); // Author
//remove_meta_box('commentsdiv','post','normal'); // Comments
remove_meta_box('commentsdiv','page','normal'); // Comments
//remove_meta_box('trackbacksdiv','post','normal'); // Trackbacks
remove_meta_box('trackbacksdiv','page','normal'); // Trackbacks
//remove_meta_box('postcustom','post','normal'); // Custom Fields
remove_meta_box('postcustom','page','normal'); // Custom Fields
//remove_meta_box('slugdiv','post','normal'); // Slug
remove_meta_box('slugdiv','page','normal'); // Slug
//remove_meta_box('revisionsdiv','post','normal'); // Revisions
remove_meta_box('revisionsdiv','page','normal'); // Revisions
//remove_meta_box('postimagediv','post','side'); // Featured Image
remove_meta_box('postimagediv','page','side'); // Featured Image
//remove_meta_box('categorydiv','post','side'); // Categories
//remove_meta_box('tagsdiv-post_tag','post','side'); // Tags
remove_meta_box('pageparentdiv','page','side'); // Page Parent etc.
}
add_action('admin_head', 'unused_meta_boxes');
—
This is a FAR better method than hacking core files.
精彩评论