[wp-hackers] Working $allowed_keys

Denis de Bernardy denis at semiologic.com
Sat Sep 3 21:51:24 GMT 2005


In classes.php, you have around lines 540-580:

$orderby = apply_filters('posts_orderby', $orderby); 

$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where."
ORDER BY " . $orderby . " $limits";

$this->posts = $wpdb->get_results($request);

So posts_orderby is likely an option for you. I recall I suggested at one
point that there should be a last minute filter like:

$request = apply_filters('posts_request', $request); 

I still think it would be useful. And if all else fails, a little later you
have:

$this->posts = apply_filters('the_posts', $this->posts);

Which allows to completely trash and redo the query.

Hope this helps,

D.




> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com 
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Kaf Oseo
> Sent: Saturday, September 03, 2005 2:01 PM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] Working $allowed_keys
> 
> 
> David House wrote:
> >>"Allowed keys" for orderby var really should include 
> 'modified'. But 
> >>since it doesn't... Beside an edit to classes.php, can I 
> override or 
> >>append to the $allowed_keys array under get_posts in WP_Query class?
> > 
> > Your best bet for the long run is to file a bug report. Sadly, that 
> > would likely only get included in the next major release.
> 
> I'll take that as a no.
> 
> -Kaf
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com 
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 



More information about the wp-hackers mailing list