Hide the “Publish” button for certain custom statuses

We’ve all done it before — accidentally published a post before it was ready to go. With Edit Flow, you can minimize these accidents by hiding the “Publish” button for your in-progress custom statuses, and then only showing it when the post has reached the last stage of production.

First, read the introduction to extending Edit Flow. Once you’ve done so, you can modify the code snippet below to work for your needs. It will simply hide the “Publish” button until you’ve saved the post with one of the statuses in the array.

 * Hide the "Publish" button until a post is ready to be published
 * In this example, we only show the "Publish button" until the post has the "Pending" status
 * @see https://editflow.org/extend/hide-the-publish-button-for-certain-custom-statuses/
function efx_hide_publish_button_until() {

	if ( ! function_exists( 'EditFlow' ) )

	if ( ! EditFlow()->custom_status->is_whitelisted_page() )

	// Show the publish button if the post has one of these statuses
	$show_publish_button_for_status = array(
			// The statuses below are WordPress' public statuses
	if ( ! in_array( get_post_status(), $show_publish_button_for_status ) ) {
            /** Classic Editor **/
			#publishing-action { display: none; }

            /** Gutenberg Editor **/
            .edit-post-header__settings .components-button.editor-post-publish-panel__toggle { display: none; }
add_action( 'admin_head', 'efx_hide_publish_button_until' );


  1. How do we enable this to only show the publish button when a custom edit-flow status is active? IE – instead of only when marked as pending, only when marked as “custom-edit-flow-status-name”? Thanks in advance

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: