WordPress: disable scheduled posts / publish posts immediately

Is there a way to disable the functionality of having a scheduled post / post in the fututre programmatically for every post on the entire website?

I have only found answers on this (code for functions.php or plugins such as “The Future is now”) from like 5-6 years ago, which apparently do not work anymore.

Related posts

1 comment

  1. You could remove the action _future_post_hook in your functions.php file:

    <?php
    function onetarek_prevent_future_type( $post_data ) {
         if ( $post_data['post_status'] == 'future' && $post_data['post_type'] == 'post' )
         {
              $post_data['post_status'] = 'publish';
         }
         return $post_data;
    }
    add_filter('wp_insert_post_data', 'onetarek_prevent_future_type');
    remove_action('future_post', '_future_post_hook');
    ?>
    

    Source: https://onetarek.com/wordpress/publish-a-wordpress-post-with-a-future-date/

Comments are closed.