get_posts() and filters

the_posts does work for all queries including the main query as well as custom queries but doesn’t work when using get_posts(). This is because get_posts() automatically suppresses all the filters. If you want to use the filters even when using get_posts, you can pass an extra key 'suppress_filters' => false in the array you pass as argument to get_posts()