• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2670

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Tutorial Requests
  • Contact
  • Videos
  • Tags
  • Log in

Premium Member? - Request custom code

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.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Brad Dalton Specializes In Genesis child theme customization & code modification. Read More…

Learn PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems