Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Add condition to "asp_query_args" › Reply To: Add condition to "asp_query_args"
January 31, 2020 at 3:10 pm
#25592
Participant
Thank you Ernesto.
I probably wasn’t clear enough. My previous code worked and I just tried yours and he works too.
But this is not what I wanted to do. I don’t want to exclude the entire form number 14 from the filter.
In my form number 14 I am searching for custom post-type in wordpress AND buddypress activities in buddypress. If we imagine that on 100 results, 20 are from buddypress, I wan’t to exclude the 20 from the filter, but the 80 others should be included in the filter.
add_filter('asp_query_args', 'map_search_phrase', 10, 2);
function map_search_phrase($args, $search_id) {
// search IDs to exclude
$exclude_ids = array(13, 14);
if ( !in_array($search_id, $exclude_ids AND results != buddypress_results ) ) {
$args['s'] = mb_strtolower($args['s']);
...
Thank you again,
Best regards,
Nicolas