Pagination only won’t work in author template

You have a couple of issues here, the main one being that your query sets posts per page to two, but the number of pages available has no relationship to your custom query. If your “Blog pages show at most” under Reading settings is set to 10, and an author only has <= 10 posts, there is no second page.

The other issue you will discover is that you’re not setting an author argument in your query, so you’re not pulling posts from a specific author.

To solve both of these problems and also eliminate the waste of resources in creating secondary queries to replace default queries, you should remove all of this from your templates and instead use the pre_get_posts action in your functions.php. This way, pagination is handled automatically.

function wpa63043_author_pre_get( $query ) {
    if ( $query->is_author() && $query->is_main_query() ) :
        $query->set( 'posts_per_page', 2 );
        $query->set( 'post_type', array('cpt1','cpt2') );
    endif;
}
add_action( 'pre_get_posts', 'wpa63043_author_pre_get' );

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino