What you are looking for isn't a parameter of WP_Query, it is the filter
This filter applies to a query's LIMIT clause before the query is sent to the database, allowing you to define a new query LIMIT.
You can find more details here: https://codex.wordpress.org/Plugin_API/Filter_Reference/post_limits
Depending on your specific case, you have two ways to solve it:
- Use a condition inside the function, like the example in the codex.
- Don't use any condition, just return
LIMIT 0, 5. So add the filter right before your query and remove it right after.
UPDATE: Added a complete example for the second solution.
Declare the functions in functions.php
return 'LIMIT 0, 5';
Then use it wherever you want
add_filter( 'post_limits', 'custom_get_posts_limit' );
// Add all your others args
get_posts( array( 'suppress_filters' => false) );
remove_filter( 'post_limits', 'custom_get_posts_limit' );