Given the following example of a custom query

$query = new WP_Query(array(
    'posts_per_page' => 7,
    'categor_name' => 'events',
    'offset' => 5

Does the order of arguments matter?

Will this query first select all posts with the given category and then offset the first 5 or will it first offset all 5 posts then select posts with given category?

  • 1
    possible typo 'category_name' => 'events',
    – prosti
    Nov 30, 2019 at 18:11

1 Answer 1


The order doesn't matter. That query will get 7 posts from the "events" category, skipping over the 5 most recent (since the default order is by date).

  • Without the typo category order doesn't matter.
    – prosti
    Nov 30, 2019 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.