WordPress process pagination pages on CPT archive with -1 limit
-
Hi!
I was trying to find out some info, but I couldn’t.
Every answer use just:function limit_posts_per_archive_page($query) { if ( is_post_type_archive('movie') && !is_admin() ) $query->set('posts_per_page', -1 ); // or set_query_var('nopaging', true); // or set_query_var('posts_per_archive_page', $limit); } } add_filter('pre_get_posts', 'limit_posts_per_archive_page');
But all of these solutions not working the way I want.
The thing is the WordPress continue to process and return pagination pages even if there is -1 limit for the first page. So I get duplicate pages:
example.com/movie/page/2
example.com/movie/page/3
…
example.com/movie/page/345And I can use ANY page number to 2147483647.
One solution I’ve found seems to dirty… there must be a way to disable pagination clear. https://wordpress.stackexchange.com/questions/304137/disable-pagination-in-posts-and-pages
Please, tell me what I’m doing wrong?
Thanks.
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘WordPress process pagination pages on CPT archive with -1 limit’ is closed to new replies.