[wp-trac] [WordPress Trac] #14349: Filter to query_posts() args

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 19 16:27:05 UTC 2010


#14349: Filter to query_posts() args
-------------------------+--------------------------------------------------
 Reporter:  lucaswxp     |       Owner:                            
     Type:  enhancement  |      Status:  new                       
 Priority:  normal       |   Milestone:  Awaiting Review           
Component:  Query        |     Version:  3.0                       
 Severity:  normal       |    Keywords:  query_posts, filter, hooks
-------------------------+--------------------------------------------------

Comment(by lucaswxp):

 Something like:
 add_filter('query_args-my_custom_arg', 'parse_my_custom_arg');
 /**
 @param string $arg_value Value of my custom arg
 @param array $sql_query That will be a ARRAY with all the sql's
 (posts_where, joins etc)
 **/
 function parse_my_custom_arg($arg_value, $sql_query){
    $sql_query['where'] .= " AND custom_something = '$arg_value' "
     // do another things
    return $sql_query;
 }

 to:
 query_posts('my_custom_arg=arg-value');

 I thought something like that =)

 Srry for the bad english, I'm brazilian

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14349#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list