1 | function change_posts_per_page( $query ) { |
2 | if ( is_admin() || ! $query ->is_main_query() ) |
3 | return ; |
4 | |
5 | if ( $query ->is_archive() ) { |
6 | $query ->set( 'posts_per_page' , '5' ); |
7 | } |
8 | } |
9 | add_action( 'pre_get_posts' , 'change_posts_per_page' ); |