Skip to content

Commit 1e59b84

Browse files
author
Ethan Jon
committed
stricter default password querying
1 parent e8661be commit 1e59b84

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wordpress/themes/coderintros/inc/passwords.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22

3-
// don't show password protected posts in feeds
3+
// by default, don't show password protected posts
4+
// this keeps password-protected posts out of our feed and xmlrpc list
5+
// we'll still need to manually filter for REST requests
46
// https://codex.wordpress.org/Using_Password_Protection
57
add_action( 'pre_get_posts', function ( $query ) {
6-
if ( is_feed() ) {
8+
if ( !is_single() && !is_page() && !is_admin() && !REST_REQUEST ) {
79
add_filter( 'posts_where', function ( $where ) {
810
global $wpdb;
911
return $where .= " AND {$wpdb->posts}.post_password = '' ";

0 commit comments

Comments
 (0)