Is there a away to create a custom post type in wordpress that will only include the default metaboxes and not any other metabox that was added by other plugins.

The idea is to use the custom post to develop a plugin, this plugin will need to have all the functions custom post type but with all the metaboxes that plugin add like all-in-seo.

I want to create a clean interface for the user and those extra metaboxes are in the way 🙂

4 Answers
4

Off the top of my head, without actually testing it, this should work. You want to test for is_admin so we don’t go running the code on the front end, then also test for the post type being equal to its slug. Edited this because I made a silly mistake before.

Reference this page of the Codex: http://codex.wordpress.org/Function_Reference/remove_meta_box

if( is_admin() ) {
    remove_meta_box('linktargetdiv', '$posttype', 'normal');
    remove_meta_box('linkxfndiv', '$posttype', 'normal');
    remove_meta_box('linkadvanceddiv', '$posttype', 'normal');
    remove_meta_box('postexcerpt', '$posttype', 'normal');
    remove_meta_box('trackbacksdiv', '$posttype', 'normal');
    remove_meta_box('postcustom', '$posttype', 'normal');
    remove_meta_box('commentstatusdiv', '$posttype', 'normal');
    remove_meta_box('commentsdiv', '$posttype', 'normal');
    remove_meta_box('revisionsdiv', '$posttype', 'normal');
    remove_meta_box('authordiv', '$posttype', 'normal');
    remove_meta_box('sqpt-meta-tags', '$posttype', 'normal');
}

Leave a Reply

Your email address will not be published. Required fields are marked *