[ad_1]
Unfortunately, you can’t just make an attachment private. That would be a neat solution. However, you can do this:
add_filter( 'relevanssi_post_ok', function ( $show, $post_id ) {
if ( ! is_user_logged_in() ) {
$post = relevanssi_get_post( $post_id );
if ( 'attachment' === $post->post_type ) {
$show = false;
}
}
return $show;
}, 11, 2 );This will exclude the attachment posts from the search for non-logged-in users.
Thread Starter
d3d5x1
(@deraxia)
That worked, thanks a lot!
