Timeline for What is wrong with my WP_Query Arguments?
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 26, 2015 at 23:19 | comment | added | Codette | I have 7 posts in the desired category (9 posts total), more than enough. I should be able to offset by 1 and still get 4 posts from my query, not 3. Update: I have edited my query to remove the offset (I initially thought it was necessary since I was using if( $post->ID == $do_not_duplicate ) continue; to keep the current post from showing up in my query, but now it doesn't seem to be necessary). I now have simply 'post_type' = 'post', 'category_name' = 'episodes', 'orderby' = 'rand', and 'posts_per_page' = 4, and now sometimes I get 4 posts, but a lot of times I only get 3 posts. | |
| Apr 26, 2015 at 22:11 | comment | added | Tom J Nowell♦ | Have you verified there are actually 4 posts to show? With the offset field, you'll need there to be 5 posts for 4 to show | |
| Apr 26, 2015 at 22:11 | comment | added | mukto90 | I have edited my answer. | |
| Apr 26, 2015 at 22:11 | history | edited | mukto90 | CC BY-SA 3.0 | added 231 characters in body |
| Apr 26, 2015 at 20:26 | comment | added | Codette | This gets rid of the post from the undesired category, however I now only have 3 posts showing, instead of 4. | |
| Apr 26, 2015 at 19:36 | history | answered | mukto90 | CC BY-SA 3.0 |