Hi,
is there a way to hide all password protected posts from the loop, i.e. from appearing in the blog, the archive, in the sidebar widget “latest posts” for example and from the RSS feed?
These posts are simply password protected by WordPress, no member plugin or such things.
Any idea please?
Thank you!
Hey COLORIT!
you would need a plugin for such function.
Cheers!
Andy
Hi Andy,
Isn’t there any possibility, to add something to the functions.php instead a plugin?
Hey!
Please add this in the functions.php file:
function avf_password_post_filter( $where = '' ) {
if (!is_single() && !is_admin()) {
$where .= " AND post_password = ''";
}
return $where;
}
add_filter( 'posts_where', 'avf_password_post_filter' );
Regards,
Ismael
sorry for the delay, but your snippet works fine, thanks a lot!