Replies: 0
Hi,
I`m using Relevanssi and WP-Members and want to excluding protected pages in my search results for not logged in users. The pages, protectes by WP-Members, should only include in search results for logged in users. Is this possible?
I tried this Code from you, but it does not work:
`add_filter( ‘relevanssi_post_ok’, ‘rlv_search_exclude_protected’, 10, 2 );
function rlv_search_exclude_protected( $allow, $post_id ) {
$post = get_post( $post_id );
if ( ! empty( $post->post_password ) ) {
$allow = false;
if ( is_user_logged_in() ) {
$allow = true;
}
}
return $allow;
}
Some idea to solve this problem? It would be glad!! And me too 🙂
Thanks a lot
Renegate