WordPress.org

Support

Support » How-To and Troubleshooting » False results with get_posts and posts_per_page = 0

False results with get_posts and posts_per_page = 0

  • devonmather
    Member

    @devonmather

    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?

    Regards

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘False results with get_posts and posts_per_page = 0’ is closed to new replies.