How to Remove the Publish Box from a Post Type

Hey there! I'm currently working on a CLI tool to deploy WordPress apps to DigitalOcean. Check it out! It's free and open source.

I’ve been working plugin, where a post type was meant to only be read from the admin panel, but never edited. Removing the capabilities to edit the post type is one piece of the puzzle, and actually hiding the publish box is another. Have you ever heard people say WordPress is written using its own APIs? Well this is a perfect example:

add_action( 'add_meta_boxes', 'my_remove_publish_metabox' );
function my_remove_publish_metabox() {
    remove_meta_box( 'submitdiv', 'your_post_type', 'side' );

WordPress uses the very same add_meta_box function you would use to add modules to your post type. This means that it can easily be removed, just like any other metabox, with remove_meta_box.

Keep in mind that removing the publish metabox doesn’t mean the user can’t publish posts, so don’t forget about capabilities too!

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.