WP SITES

3095 Coded Tutorials & 297 Plugins

Set Posts Per Page Limit For Each Author Archive Page

Generally, the number of posts displayed on your archives pages is determined by your reading settings.

Reading Settings

If you want to control the number of posts displayed on a specific archive page like your author archives, you can.

Use the pre_get_posts function in your functions.php file like this:

function set_author_archive_limit( $query ) {
    if ( is_admin() || ! $query->is_main_query() )
        return;

    if ( is_author() ) {
        
        $query->set( 'posts_per_page', 10 );
        return;
    }
}
add_action( 'pre_get_posts', 'set_author_archive_limit', 1 );

Simply change the 10 in the code to any number you like.

Was this helpful?

Yes
No
Thanks for your feedback!

Leave a Reply