Sometimes, you need to exclude password-protected posts from a View’s output.

You can use Toolset to add the following code to your site.

The only edit required is for the ID(s) of the affected View(s).

Code Snippet
<?php 
/**
 * User defined values: fill here the IDs of the Views that you want to affect with this snippet.
 * For a single View, use $target_views = array( XXX );
 * For multiple Views, use $target_views = array( XXX, YYY );
 * In this example, we target a View with ID equal to 204.
 */
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
add_filter( 'wpv_filter_query', 'tssnippet_omit_protected_posts', 101, 3 );
function tssnippet_omit_protected_posts( $views_query_args, $view_settings, $view_id ) {


    $target_views = array( 204 );

    if ( in_array( $view_id, $target_views ) ) {
        $views_query_args['post_password'] = '';
    }

    return $views_query_args;
}