[wp-hackers] The 'query' filter sledgehammer

Filipe Fortes fortes at gmail.com
Mon Jan 8 17:21:24 GMT 2007


I'm the author of the postlevels plugin, which allows logged in users to see
private posts. In order to ensure that posts aren't seen if the plugin is
disabled, the posts have a post_status = private . This, obviously,
conflicts with SQL queries that depend upon post_status = public.

The the loop, this issue is solved easily, as the filters posts_join and
posts_where give me the hooks to edit the SQL. However, these are the only
hooks, which means that archives, categories, and next/prev links don't work
correctly (see the ancient trac issues:
#1368<http://trac.wordpress.org/ticket/1368>,
#1442 <http://trac.wordpress.org/ticket/1442>,
#1691<http://trac.wordpress.org/ticket/1691>,
and #2415 <http://trac.wordpress.org/ticket/2415>).

With some careful if statements and string replacement, it looks like I can
work around not having these hooks -- obviously this is not a very stable
solution, since it's pretty dependent upon whatever queries are hardcoded
today.

Questions:

   1. Now that there is a query filter, does this mean that no more
   "narrow" SQL filters will be added? I.e. should I stop holding my
   breath for those Trac issues?
   2. If not, what would it take to get those filters added for 2.1?
   They've been around for years, and do have patches included. I'm happy to
   re-code / test the patches myself.

Thanks!


More information about the wp-hackers mailing list