Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › limit search › Reply To: limit search
October 6, 2022 at 3:51 pm
#39545
Keymaster
Sure, it’s like this:
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' => 'customfield',
'value' => 'abc'
'operator' => 'LIKE',
'allow_missing' => false
);
} else if ( $id == 12 ) {
$args['post_parent'] = array(3239);
$args['post_meta_filter'][] = array(
'key' => 'customfield',
'value' => 'xyz'
'operator' => 'LIKE',
'allow_missing' => false
);
}
return $args;
}