Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to exclude certain media files from the search? › Reply To: How to exclude certain media files from the search?
June 15, 2023 at 10:22 am
#43076
Keymaster
You are welcome 🙂
No problem, that is also possible via this changed code:
add_filter("asp_query_args", "asp_query_args_change", 10, 2);
function asp_query_args_change($args, $search_id) {
if ( $search_id == 1 ) {
$include_ids = array(1, 2, 3); // Media file IDS to include
// No change below
$ids = implode(', ', $include_ids);
$args['attachment_query']['where'] = "AND $wpdb->posts.ID IN($ids)";
return $args;
}
}
Just change the number on line with the ID of the search for which this code should be effective: if ( $search_id == 1 ) {