WordPress   

Change total number of posts in WordPress archive pages using pre_get_posts

function change_total_posts_archive($query) {
	if (!is_admin() && $query->is_main_query() && $query->is_archive) 
		$query->query_vars['posts_per_page'] = 10; 
	return $query; 
}
add_filter('pre_get_posts', 'change_total_posts_archive'); 
Need Professional Support for Your Website Problems?

Whether you're facing website issues or struggling with code implementation, our team is here to assist. Hire us to get your website back on track.

Hire Us