[wp-hackers] Query Vars Hook

Aaron Brazell emmensetech at gmail.com
Mon Jul 24 20:52:12 GMT 2006

Following on with a email discussion I started a few weeks ago about hooks
and Loops, I've completed what I set out to do (Thanks, Andy! Your
recommendation got me pointed in the right direction anyway), I've found
that after my plugin sorts thorugh the Loop and does displaying the way I
want it to on the blog, it also reorders the posts in Manage > Posts (
edit.php).  I'm using get_query_vars() in my plugin to sort through
conditions for displaying the Loop in different ways, but I realize there is
nothing that I can see to prevent the Loop in the wp-admin from getting
reordered. Of course, describing this is difficult without showing code so
here's just a brief bit of the code I have written into my function. In each
of these cases, the query is simply passed through unchanged. I don't know
if there's a way to add something to pass the query through unchanged if it
is called inside of wp-admin:

    if(get_query_var('s') ||
        get_query_var('search') ||
        get_query_var('p') ||
        get_query_var('name') ||
        get_query_var('pagename') ||
        ) return $query;

Aaron Brazell
Author & Blogger, http://technosailor.com
Systems Admin, http://b5media.com
Sports Channel Editor, http://b5media.com

More information about the wp-hackers mailing list