3

I took a look at the WP_Query->get_posts() function and couldn't see any action/filter that is called AFTER a query finishes.

I want to be able to manipulate the results once they are sent, rather than the query itself (Using a Human Name Parser to sort by last name).

I'm revamping an old site that alters the global $wp_query->posts right within archive.php, so I was just wondering if there was a way to take this logic completely out of the archive file and store it with my other CPT functionality.

Cheers!

1 Answer 1

5

The is the the_posts filter, which sounds like what you want.

function filter_the_posts($posts) {
  var_dump($posts);
}
add_filter('the_posts','filter_the_posts');
1
  • Perfect! I saw the_post, I think I must have been a little too far down in the caching area :). Cheers! Jul 5, 2013 at 14:45

Your Answer

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

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