if("Auto Draft") never publish

I’m trying to disable ‘Auto Draft’ posts from being published on the homepage.

I looked at a few solutions like

define('WP_POST_REVISIONS', false );

But we don’t want to disable it completely, we just don’t want empty draft posts from ever appearing.

I also tried attaching a hook to the transition_post_status with

function on_all_status_transitions_pending( $new_status, $old_status, $post ) {
    if ( $new_status == "publish" AND $post->post_title == "Auto Draft") {
       # do something
add_action(  'transition_post_status',  'on_all_status_transitions_pending', 10, 3 );

But this works only if a ‘human’ publishes a post, when WordPress makes the ‘Auto Drafts’ the above doesn’t detect it.

Thank you

Read more here: if("Auto Draft") never publish

Leave a Reply

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