get_posts always returning the same number of posts = 5

get_posts() has some defaults set, including numberposts equal to 5. Since it’s not considered to be a loop by itself those are independent and not affected by admin settings.

So simply pass in arguments numberposts/posts_per_page (same thing) number for how many posts you want or -1 for all matching posts.

error code: 523