False results with get_posts and posts_per_page = 0
Working on a real estate site, users can shortlist properties and store them in a cookie, for later browsing. This all works fine, but if they have no shortlisted properties then the 5 most recent properties get returned.
$args = array( ‘posts_per_page’ => $shortCount,
‘post_type’ => ‘property’,
‘include’ => $shortlistedObj->properties
$posts = get_posts($args);
If I print_r($args) before get_posts() I get the following,
[posts_per_page] => 0
[post_type] => property
[include] => Array ()
Is this a bug or am I using posts_per_page incorrectly?
- The topic ‘False results with get_posts and posts_per_page = 0’ is closed to new replies.