How to get Posts Greater Than X (ID) using get_posts

arguments, posts, wordpress

Solution

A nice solution if you want to get the posts with an ID lower than X:

$post_ids = range(1, 555); 

$args = array('numberposts' => 10, 
'tag' => 'my-tag', 
'post__in' => $post_ids');

$posts = get_posts($args);

props to girlieworks here: https://wordpress.org/support/topic/wp_query-how-to-get-posts-with-and-id-lower-than?replies=7#post-8203891

Problem

``` $args = array('numberposts' => 10, 'tag' => 'my-tag', 'ID' => 555'); $posts = get_posts($args); ``` I want to bring only 10 records from an specific tag and that the ID is less than a number. Is there any way to do this with the get_posts arguments? How can I specify Greater Than, Less Than or Not Like in the arguments array? Thanks...

Original source