Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

If i don't supply a paged value (get the first page), it works. But when i try to get the next page by doing paged => 2 it doesn't find anything even though there are plenty of posts to get.

That's the first page showing the first ten posts. It works fine. If you scroll to the bottom and open the "Ladda fler" link in a new tab (otherwise it will ajax it), it doesn't find anything.

At the top of the page you see the arguments i pass to WP_Query, for debugging purposes. As you can see, on page two i also pass paged => 2 which returns nothing.

Is there something more i need to supply? Am i missing something?

share|improve this question
1  
How many posts do you have? Isn't it so that you have exactly 10 posts and you're showing them all on first page? –  Krzysiek Dróżdż Jun 26 '13 at 9:50

1 Answer 1

Isn't it so that you have exactly 10 posts and you're showing them all on first page.

$found_posts - The total number of posts found matching the current query parameters

found_posts on your first page shows 10. All of these posts are shown on first page. So there are no posts to show on second page - therefore it's empty.

share|improve this answer
    
I'm not printing out $query->found_posts, i'm printing out count($posts); (also, i lied, i'm using get_posts(), not WP_Query(). But i read your comment above and it turns out you were actually right, there were simply just not enough posts. The thing is, i'm using one taxonomy on two post_types, so when i went into the taxonomy and looked at the post count each term was used in, it showed well above 10 on most terms. ... –  qwerty Jun 26 '13 at 9:58
    
... But since i'm using the taxonomy for multiple post types, it didn't count correctly (a lot of the posts were from the other post type). I hope this makes sense. Anyway, include the comment in your answer and i'll mark it as accepted. I've been struggling with this for over an hour, kind of silly it has been working from the beginning. Oh well. Thank you! –  qwerty Jun 26 '13 at 9:58
    
Answer updated, so you can mark it accepted :) –  Krzysiek Dróżdż Jun 28 '13 at 11:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.