Home › Forums › General Issues › ACF Relationship Field Search Filtering – Also look for taxonomies › Reply To: ACF Relationship Field Search Filtering – Also look for taxonomies
According to this site for $args to use https://www.billerickson.net/code/wp_query-arguments/
'meta_query' => array( //(array) - Custom field parameters (available with Version 3.1).
array(
'key' => 'color', //(string) - Custom field key.
'value' => 'blue', //(string/array) - Custom field value (Note: Array support is limited to a compare value of 'IN', 'NOT IN', 'BETWEEN', or 'NOT BETWEEN')
'type' => 'CHAR', //(string) - Custom field type. Possible values are 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'. Default value is 'CHAR'.
'compare' => '=', //(string) - Operator to test. Possible values are '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. Default value is '='.
),
array(
'key' => 'price',
'value' => array( 1,200 ),
'compare' => 'NOT LIKE'
)
So following the above example I would maybe try something like this and add as many keys as you need to in order to search all the taxonomies you want.
$args['meta_query'] = array(
array(
'key' => my_key_1,
'value' => $args['s'],
'compare' => 'LIKE',
),
array(
'key' => my_key_2,
'value' => $args['s'],
'compare' => 'LIKE',
),
array(
'key' => my_key_3,
'value' => $args['s'],
'compare' => 'LIKE',
)
);
return $args;
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.