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.

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!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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');
share|improve this answer
    
Perfect! I saw the_post, I think I must have been a little too far down in the caching area :). Cheers! –  Eric Holmes Jul 5 '13 at 14:45

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.