0

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
  • 1
    possible typo 'category_name' => 'events',
    – prosti
    Commented Nov 30, 2019 at 18:11

1 Answer 1

2

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).

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

Your Answer

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