If the date query doesn’t work because of modified post dates (e.g. if the posts’ timeline is no longer linear), here’s a posts_where
filter’s suggestion (untested):
add_filter( 'posts_where', function( $where, $query ) use ( &$wbdb ) {
$id = $query->get( '_id__gt' );
if( is_int( $id ) && $id > 0 ) {
$where .= $wpdb->prepare(
" AND %i.ID > %d ",
"{$wpdb->posts}",
$id
);
}
return $where;
}, 10, 2 );
to support this type of _id__gt
argument in WP_Query
for ID greater than some positive integer number:
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'_id__gt' => 296380, // <-- our new input argument!
);
$my_query = new WP_Query( $args );
But using queries based on some given ID values in production, sounds brittle.