Olivia - Increase Posts on Tag Page

Note: If any mistakes are made in the following steps, you will get a white screen and no longer be able to access your site without the help of a developer or your web host.

Navigate to  APPEARANCE > EDITOR and choose FUNCTIONS.PHP from the list of files.

Copy and paste the following code at the very bottom of the file.

//* Update number of posts per page on archive
function olivia_tag_posts_per_page( $query ) {
     // do not alter the query on wp-admin pages and only alter it if it's the main query
    if (!is_admin() && $query->is_main_query()){
        // alter the query for the home and category pages 
            $query->set('posts_per_page', 8);

add_action( 'pre_get_posts', 'olivia_tag_posts_per_page' );

Replace the number 8 with the number of posts you want shown. 

Click Save Changes.

Still need help? Contact Us Contact Us