WordPress permalinks incorrect for future posts


WordPress 4.2 isn’t displaying future posts with their pretty permalink. But add this function to your theme, and you’ll be cruising the mountains again.

Add this to functions.php:

Thanks to keesiemeijer at https://wordpress.org/support/topic/urls-incorrect-for-scheduled-posts#post-7047628, and a link to the trac ticket: https://core.trac.wordpress.org/ticket/30910

If WordPress 5.6 is hiding future posts when logged out:

add_filter('get_post_status', function($post_status, $post) {
if ($post->post_type == 'events' && $post_status == 'future') {
return "publish";
return $post_status;
}, 10, 2);

From https://wordpress.stackexchange.com/a/329531

Need help getting the code onto your site? Let me know!