Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Filter search results based on authentication status › Reply To: Filter search results based on authentication status
August 18, 2020 at 10:03 am
#29029
Keymaster
Hi,
That looks almost all right, but the $r variable in that case does not contain a post object, so this should be it:
add_filter('asp_results', 'asp_fix_groups_exclusions', 10, 1);
function asp_fix_groups_exclusions($results) {
// Group based exclusions
if ( class_exists('MeprRule') ) {
foreach ($results as $k => &$r) {
if ( isset($r->post_type) ) {
$post = get_post( $r->id );
if ( MeprRule::is_locked($post) )
unset($results[$k]);
}
}
}
return $results;
}