When searching for posts with a parent term: When will posts with its child terms be found?
e.g.
FRUIT
- APPLE
- BANANA
When will posts with BANANA (but WITHOUT fruit!) be found when searching for FRUIT?
I was given the following code, but it makes fatal errors, even after checking the single quotes.
add_filter( 'wpv_filter_query', 'taxonomy_view_func', 10, 2 );
function taxonomy_view_func( $query, $setting ) {
if ( $setting['view_id'] = 5522 ) {
if ( isset( $query['tax_query'] ) ) {
foreach ( $query['tax_query'] as $k => $v ) {
if(isset($v['taxonomy']) && $v['taxonomy'] == 'armedium') {
$query['tax_query'][$k]['include_children'] = true;
break;
}
}
}
}
return $query;
}
THANK YOU, kind regards,
Achim
Hello,
Since it is a custom codes problem, please provide a test site with the same problem, fill below private message box with login details, also point out the problem page URLs, where I can edit your custom PHP codes, I need a live website to test and debug, thanks
Ok, line 4 was missing an equal sign. (And maybe there were some problems with spaces?)
And now, after changing the search to "one of the selected" instead of "all of the selected", VOILA!
Thank you, have a good time!
My issue is resolved now. Thank you!