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.
[sourcecode language=”php”]
/**
* 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 http://editflow.org/extend/hide-the-publish-button-for-certain-custom-statuses/
*/
function efx_hide_publish_button_until() {
if ( ! function_exists( ‘EditFlow’ ) )
return;
if ( ! EditFlow()->custom_status->is_whitelisted_page() )
return;
// Show the publish button if the post has one of these statuses
$show_publish_button_for_status = array(
‘pending’,
// The statuses below are WordPress’ public statuses
‘future’,
‘publish’,
‘schedule’,
‘private’,
);
if ( ! in_array( get_post_status(), $show_publish_button_for_status ) ) {
?>
<style>
/** Classic Editor **/
#publishing-action { display: none; }
/** Gutenberg Editor **/
.edit-post-header__settings .components-button.editor-post-publish-panel__toggle { display: none; }
</style>
<?php
}
}
add_action( ‘admin_head’, ‘efx_hide_publish_button_until’ );
[/sourcecode]