get_posts gives different result than wpdb->get_results

Why is it always that I look for a solution for hours… then post it here and within a few minutes I find the solution myself….

I found the solution in this post.

The default arguments for get_posts() function include ‘numberposts’ => 5.

So when I set number, it was ignored and 5 was set for numberposts. The correct values are posts_per_page and numberposts (imo a poorly chosen variable).