Change Number of Posts on Category Page Feed

Updating your Reading Settings within WordPress affects all templates of your site:

Reading Settings screenshot

However, if you’d like to adjust the number of Posts shown on a specific Category or Archive page, you can target this area specifically using a Hook function:

add_filter('pre_get_posts', 'posts_in_category');

function posts_in_category($query){
    if ($query->is_category) {
        if (is_category('category-slug')) {
            $query->set('posts_per_archive_page', 3); // number of posts to show
        }
    }

}

Sourced here.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.