rewrite get_posts to call WP_Query->get_posts, using temporary filters as needed
|Reported by:||kevinB||Owned by:||markjaquith|
The get_posts function in post.php seems redundant and hinders plugin API consistency. Plugin functions filtering WP_Query->get_posts should not suffer the ignominy of unfiltered results sneaking out through a redundant, unhookable equivalent function. Why not just make get_posts wrap WP_Query->get_posts?
Attached patch rewrites get_posts to call WP_Query->get_posts. The arguments numberposts and category are remapped to posts_per_page and cat.
get_posts arguments which WP_Query->get_posts does not (yet?) support are include, exclude, meta_key, meta_value, post_parent. These are supported by way of temporary filters on posts_join and posts_where.
If the future development path involves upgrading WP_Query->get_posts to support these other args, get_posts can be simplified, ultimately to a 10-line wrapper.
Since WP_Query->get_posts already supports multiple category inclusion/exclusion, this solves #1625 too.
If this is not the direction y'all want to go, please say so and I will submit another ticket with new hooks in post.php~get_posts. But the wrapper approach seems cleaner to me. Why have two sets of hooks for the same query?
For sample usage, see themes\tarski\footer.php