Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Disabled pages and posts shown in search results › Reply To: Disabled pages and posts shown in search results
February 17, 2023 at 11:07 am
#41442
Keymaster
You are welcome!
Yes, indeed there is an error in the code (as I couldn’t test it), you have corrected it properly, you can also use this version with the extra bracket for nicer encapsulation:
add_filter( 'asp_results', 'asp_digimember_access_filter', 10, 1 );
function asp_digimember_access_filter( $results ) {
foreach ($results as $k=>&$r) {
if ( isset($r->post_type) ) {
if ( digimember_currentUserAccessDenied($r->post_type, $r->id) ) {
unset($results[$k]);
}
}
}
return $results;
}
You can disable the keyword suggestions here: https://documentation.ajaxsearchpro.com/autocomplete-and-keyword-suggestions/keyword-suggestions