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
Hi Ernest,
wow, thank you for your efforts.
When I added your provided code my whole site crashed. Then I removed one closing brace and now it works. Just to make sure, I used this code instead:
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;
}
Am I right with my assumption that in your code there was one brace too much?
As I said, it works now and doesn’t return disabled search results. However, it still suggests me “Did you mean: ” and then search input suggestions for disabled pages are displayed. Is it possible to disable search suggestions for disabled pages and posts as well?
Thank you a lot again for your help!