Support » Fixing WordPress » Posts per page limit not working

  • I have a custom template for the front page which uses WP Query to find the latest post and then the 3 most recent sticky posts (separate queries).

    The first query is:

    $args = array(
    	'post_type' => 'post' );
    $latest_query = new WP_Query( $args );
    //The output code...

    Then the output code. The second query is:

    $args2 = array(
    	'posts_per_page' => 3,
    	'post__in'  => get_option( 'sticky_posts' ));
    $stick_query = new WP_Query( $args2 );

    They are both ignoring the posts per page arguement and usingt he 10 posts setting as set in wordpress settings. I have tried adding in:

    $latest_query->set(‘posts_per_page’, 1);

    And also tried the limit filter, but none of these work.

    I also have a plugin which shows the 3 sticky post but it too isn’t sticking to that limit. Please help!

  • The topic ‘Posts per page limit not working’ is closed to new replies.