Skip to content

Instantly share code, notes, and snippets.

@wpchannel
Last active February 18, 2018 19:02
Show Gist options
  • Save wpchannel/eae87447e3f8092da6f40fa133394d8f to your computer and use it in GitHub Desktop.
Save wpchannel/eae87447e3f8092da6f40fa133394d8f to your computer and use it in GitHub Desktop.
function wpc_exclude_protected_posts($query) {
if (! is_admin() && $query->is_main_query()) {
$query->set('has_password', false);
}
}
add_action('pre_get_posts', 'wpc_exclude_protected_posts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment