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
April 4, 2020 at 2:04 pm
#26583
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;
}