开发者

Can I change the default admin for wordpress pages?

开发者 https://www.devze.com 2023-01-25 21:44 出处:网络
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 th

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消