How to Display Details page of future (scheduled) posts

A much cleaner solution is to just set the post status via pre_get_posts. By default, the main query only shows published posts to logged out users and published and private posts to logged in users.

We can add future posts to main query with pre_get_posts

add_action( 'pre_get_posts', function ( $q )
{
    if (    !is_admin()
         && $q->is_main_query()
         && $q->is_single()
    ) {
        $q->set( 'post_status', ['publish', 'future'] );
    }
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)