Omit password protected posts from a View.

Add the following filter to exclude password-protected posts from the output of a View.

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

function tssupp_omit_protected_posts( $view_args, $view_settings, $view_id ){

	if ( in_array( $view_id, array( 204 ) ) ) { //Edit for IDs of Views

		$view_args['post_password'] = '';
	}

	return $view_args;
}
add_filter( 'wpv_filter_query', 'tssupp_omit_protected_posts', 101, 3 );

Let us know if this snippet is not working for you:

This snippet doesn’t work
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments