| @@ -583,8 +583,12 @@ | ||
| 583 | 583 | $query = new \WP_Query( $args ); |
| 584 | 584 | $posts = []; |
| 585 | 585 | |
| 586 | 586 | foreach ( $query->posts as $post ) { |
| 587 | + // Skip password-protected posts - their content should not be searchable | |
| 588 | + if ( ! empty( $post->post_password ) ) { | |
| 589 | + continue; | |
| 590 | + } | |
| 587 | 591 | $posts[] = $this->format_post_for_indexing( $post ); |
| 588 | 592 | } |
| 589 | 593 | |
| 590 | 594 | return [ |
| @@ -953,8 +957,13 @@ | ||
| 953 | 957 | |
| 954 | 958 | foreach ( $post_ids as $post_id ) { |
| 955 | 959 | $post = get_post( $post_id ); |
| 956 | 960 | if ( $post && $post->post_status === 'publish' ) { |
| 961 | + // Skip password-protected posts - their content should not be searchable | |
| 962 | + if ( ! empty( $post->post_password ) ) { | |
| 963 | + $skipped++; | |
| 964 | + continue; | |
| 965 | + } | |
| 957 | 966 | // Skip posts with non-indexable content (shortcodes only, binary, too short) |
| 958 | 967 | if ( ! $this->is_content_indexable( $post ) ) { |
| 959 | 968 | $skipped++; |
| 960 | 969 | continue; |