the_posts filter been called multiple time
‘the_posts’ is an action fired everytime WP_Query get posts, for main query and for other secondary queries, so when you do something like: $foo = new WP_Query($args); in a widget or elsewhere (shortcode, related posts…) ‘the_posts’ is triggered again. However there is only one main query, so you can use a conditional and do what … Read more