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


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: