Hi @bcourcet
We don’t have any option to hide protected posts on a listing page like Blog page. You can try to use this code snippet to exclude those posts on Blog page:
add_action( 'pre_get_posts', function ( $query ) {
if ( ! is_admin() && $query->is_main_query() && 'blog' === $query->query['pagename'] ) {
$posts = get_posts( array( 'post_type' => 'post', 'post_status' => 'publish', 'numberposts' => - 1 ) );
if ( empty( $posts ) ) {
return;
}
$protected_posts = array();
foreach ( $posts as $post ) {
if ( ! members_can_current_user_view_post( $post->ID ) ) {
$protected_posts[] = $post->ID;
}
}
if ( empty( $protected_posts ) ) {
return;
}
$query->set( 'post__not_in', $protected_posts );
}
} );
To hide posts from search results, you can try this plugin: https://www.ads-software.com/plugins/mpress-hide-from-search/
I hope that helps.