I'm digging out on old question as no solution came out. How to limit page paginationHow to limit page pagination
I'm looking for a way to limit pages on homepage and categories (archive.php). I have around 200k posts spread into about 50 categories. If I leave the default pagination, homepage has 20k pages. Then most categories have over 5k pages. This will send google in some long long loops... and each time a post is added (200/day) google will start again etc... when all I want is google to look into recent posts (this is a news website)
All I need is to let the visitors navigate threw the 10 first pages of each categories.
Is there a nice way for doing this?
I've tried different things described here without success. Limit number of pages in paginationLimit number of pages in pagination
// this didn't work (beyond page 10 "next page" take us back to page 1)
function wpcodex_filter_main_search_post_limits( $limit, $query ) {
return 'LIMIT 0, 100';
}
add_filter( 'post_limits', 'wpcodex_filter_main_search_post_limits', 10, 2 );
Removing the page links on page 10 would work for me even if you can manually enter page 11 and see page 11 posts... all I want is google not to find a link.
Deleting old posts is not an option, nor running a double query.
Thanks for your help