Wordpress | Filter Query of custom post type archives via functions

add_filter( 'pre_get_posts', 'cpt_archive_query' );
function cpt_archive_query( $query ) {
    if( $query->is_main_query() && $query->is_post_type_archive('cpt_name') ) {
        $query->set( 'posts_per_page', 24 );
        $query->set( 'orderby', 'name' );
        $query->set( 'order', 'asc' );
My website may contain fan art inspired by existing characters from movies or tv shows, I dont own any rights. Any copyright owner willing to remove those fan arts can contact me here. This is a personal portfolio, the sole use of cookies are for analysing my traffic through Google Analytics, if you're ok with that please accept this terms by closing this disclaimer.