[wp-hackers] Intervening in $posts derivation in wp-blog-header

Ryan Boren ryan at boren.nu
Thu Jun 17 05:07:58 UTC 2004


On Wed, 2004-06-16 at 22:46, ayj & j wrote:
> So, in this example, I was wanting to be able to cause wp-blog-header to run
> as normal for all page types but to add a further WHERE condition to the
> $posts database query that excludes, one way or another, the sticky posts
> and hence returns the correct number of posts for that page excluding the
> stickies.

We could add something like:

$where = apply_filters('posts_where', $where);

to query_posts.  Plugin writers would have to be very careful they
didn't butcher queries, of course.

For those just wanting to post-process $posts, we could do the following
after we call query_posts() in wp-blog-header.php.

$posts = apply_filters('the_posts', $posts);

Ryan




More information about the hackers mailing list