0
Q:

pre_get_posts custom post type archive

<?php
function wpmark_alter_team_archive_template_query( $query ) {
    
    /* only proceed on the front end */
    if( is_admin() ) {
	    return;
    }
    
    /* only on the person post archive for the main query */
    if ( $query->is_post_type_archive( 'wpmark_person' ) && $query->is_main_query() ) {
	    
        $query->set( 'posts_per_page', -1 );
        
    }
    
}

add_action( 'pre_get_posts', 'wpmark_alter_team_archive_template_query' );
?>
0

New to Communities?

Join the community