The basics of scheduling in WordPress are quite simple: If you give a WordPress post a published date set in the future, it’ll remain “hidden” on your website until that date and time arrives. It’ll then appear, right on time, at the top of your list of public posts.
But here’s an interesting problem: Social media is now a major driver (maybe the driver) of traffic to digital media websites. When you schedule your post in WordPress, you’ll also naturally want to schedule that post to appear on Facebook and Twitter – but that would require the WordPress post to be public, which in its “future” post status isn’t yet.
The code snippet below can be placed in your theme’s functions.php file, and allows non-logged-in website visitors to view posts in the “future” post status as well as merely “publish”ed posts.
// Allow site visitors (people not logged in to WordPress) to view posts in the "future" post status. function show_future_posts_pre_get_posts($query) { if ( is_single() && !is_admin() && $query->is_main_query() ) { if ( !is_user_logged_in() ) { $query->set("post_status", array("publish", "future")); } } } add_filter('pre_get_posts', 'show_future_posts_pre_get_posts');
Reference: