DocumentationOnline documentation for Ajax Load More
Exclude Password Protected Posts
The code below will exclude posts that require a password from Ajax Load More listings using pre_get_posts.
functions.php
<?php
function alm_exclude_password_protected_posts( $alm_query ) {
if ( isset( $alm_query->query['alm_id'] ) && ! $alm_query->is_singular() ) {
$alm_query->set( 'has_password', false );
}
}
add_action( 'pre_get_posts', 'alm_exclude_password_protected_posts' );
PHP