WordPress integration is showing scheduled posts on my webite

Hello,

I’ve been using this neat snippet of code to integrate wordpress with my non-wordpress website and it’s been doing wonders for me.

<?php
define('WP_USE_THEMES', false);
require('blog/wp-blog-header.php');
?>
<?php

$number_of_posts = 5;
$args = array( 'numberposts' => $number_of_posts );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent_post ){
echo "<span>".$recent_post['post_date']."</span> <br>";
echo "<h3>".$recent_post['post_title']."</h3>";
echo  "<p>".$recent_post['post_content']."</p><br><br>";

}

?>

However, even the scheduled posts that are not supposed to show… well… they show up anyway on the main page. I’ve tried a loda of different methods but don’t seem do get it to work correctly.
Is there any way to make it so my scheduled posts not show up until the scheduled date using this method?
Thanks in advance!

The page I need help with: [log in to see the link]



Source link