[wp-trac] [WordPress Trac] #18747: Custom Taxonomy Search/Filter Bug
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 23 00:26:30 UTC 2011
#18747: Custom Taxonomy Search/Filter Bug
--------------------------------------+----------------------
Reporter: wordpressplugindeveloper | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Query | Version:
Severity: normal | Resolution: invalid
Keywords: |
--------------------------------------+----------------------
Comment (by wordpressplugindeveloper):
Sorry for the late reply. I was inspired by your tax_query array.
Here is the ultimate solution
{{{
add_action('request','my_request');
function my_request($request) {
if ($request['post_type']=='listing' &&
isset($request['business']) ) {
$term = get_term_by('id',$request['business'],'business');
$request['tax_query'] = array(
array(
'field' => 'slug',
'taxonomy' => 'business',
'terms' => array($term->slug),
)
);
$request['business'] = $term->slug;
}
return $request;
}
}}}
in the 1704th line,
{{{ $term = $q[$t->query_var]; }}} , the term will be the business
taxonomy term id however the field is slug. so I do this {{{
$request['business'] = $term->slug; }}} , right now it is working great!
Many thanks to you.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18747#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list