This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: limit search

#39544
23volt23volt
Participant

Hello Ernest,

but in your code here

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);
	} else if ( $id == 12 ) {
		$args['post_parent'] = array(3239);
	}
	
	$args['post_meta_filter'][] = array(
		'key'     => 'customfield', // meta key
		'value'   => 'abc'
		'operator' => 'LIKE',	   // You can also try ELIKE here for more strict match
		'allow_missing' => false   // allow match if this custom field is unset
	);

	return $args;
}

there is not this logic integrated:
If widget ID 3 –> post_parent = 11748 OR customfield = abc;
If widget ID 12 –> post_parent = 5000 OR customfield = xyz;

There is a chance to archive this?