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

Reply To: Restrict search results according to the user permissions

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Restrict search results according to the user permissions Reply To: Restrict search results according to the user permissions

#26583
Ernest MarcinkoErnest Marcinko
Keymaster

Hi Francis,

We can’t do paid support or custom work, but I found an older thread where something similar was resolved.

Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_filter( 'asp_results', 'asp_filter_posts_by_capability', 10, 1 );
function asp_filter_posts_by_capability( $results ) {
	foreach ($results as $k => &$r ) {
		if ( isset($r->post_type) && !sfwd_lms_has_access($r->id) )
			unset($results[$k]);
	}
	return $results;
}