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

Reply To: Filter search results based on authentication status

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

#29029
Ernest MarcinkoErnest Marcinko
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;
}