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.
1 2 3 4 5 6 7 8 |
<?php // functions.php add_action( 'pre_get_posts', 'alm_exclude_password_protected_posts' ); 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 ); } } |