Exclude password-protected posts in Ajax Load More

Exclude password-protected posts in Ajax Load More on child sites.

Snippet Type

Execute on Child Sites

Snippet

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 );
	}
}
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.