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 10:46 am
#41440
Keymaster
Hi,
It is very likely possible. I have googled a bit and found their API, so in theory it is possible to use a custom code to filter the posts not accessible for the current user.
Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
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;
}