Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › limit search › Reply To: limit search
October 12, 2022 at 5:07 pm
#39622
Keymaster
Thank you for your kind words 🙂
1. I am not a 100% sure, but from the output it seems like an incorrect post type was selected (something like “revision” or a similar name). Make sure that only the required post types are selected.
Another possible issue might be, that the post statuses are entered incorrectly. On the same options page (Search Sources -> Post type search), make sure that only the publish post status is entered.
2. Yes, it is possible, by passing the values as arrays, see this code:
add_filter('asp_query_cpt', 'asp_change_query_directly', 10, 1);
function asp_change_query_directly($q) {
global $wpdb;
return str_replace("AND $wpdb->posts.post_parent IN", "OR $wpdb->posts.post_parent IN", $q);
}
add_filter( 'asp_query_args', 'asp_include_only_parent_ids', 10, 2 );
function asp_include_only_parent_ids( $args, $id ) {
if ( $id == 3 ) {
$args['post_parent'] = array(11748);
$args['post_meta_filter'][] = array(
'key' => 'ad_location',
'value' => array('62b9acbc2709e', '123', 'ABC'),
'operator' => 'ELIKE',
'allow_missing' => false
);
}
return $args;
}