Found the answer!!!
Put this in functions.php (or a required file). Of course, change it to suit your needs. I needed something that only worked for product category archives.
function modify_product_cat_query( $query ) {
if (!is_admin() && $query->is_tax("product_cat")){
$query->set('posts_per_page', 2);
}
}
add_action( 'pre_get_posts', 'modify_product_cat_query' );
I also took out the posts_per_page parameter from my WP_Query.
Related Posts:
- WordPress /page/2 404 pagination problem – what to do?
- Non existing blog pages are not redirected to 404
- category/category_name pagination 404 error
- Pagination gives 404 in template
- 404 not found error on pagination
- Pagination on home page not working
- WordPress triggers 404 on page 2 for custom search query
- Pagination 404s on custom query
- WP Page Navi. 404 error when using posts per page parameter [duplicate]
- Error 404 on pagination on homepage
- Page not found yet the posts are listed?
- remove rel=next on category page (if
- Changing post per page causing 404 for pagination. Need a redirect htaccess rule
- Custom pagination generates title 404
- Pagination 404 Not Found child page
- paged query leads to 404? [duplicate]
- Please Help me with Archive 404 Pagination
- how to get pagination link url?
- add_rewrite_rule – working fine but broken for pagination
- How can I see all of a post’s comments on a single page as a reader, if pagination is enabled?
- Check if on last page of paginated post using wp_link_pages
- How to paginate a list of tags
- How do I sort multiples pages?
- 404 on category.php pagination
- WordPress pagination on custom script
- Broken pagination
- pagenavigation not showing the next page just linking back to the main page [closed]
- Paginate get related post by author function
- Keep Pagination in Tabs
- Need help understanding pagination parameters
- redirect pages with no content, instead of 404 error, using max_num_posts?
- Custom query in archive.php with pagination nightmare
- Display only the current page number and another numbered page in pagination
- Display post links under month in paginated archive
- wp_list_categories pagination
- How to test pagination? [closed]
- Link to previous month’s posts
- How to get “last year from [spec year] that has posts”?
- Pagination url canonical problem
- WordPress loading index page instead of archive.php
- How can I paginate a list of related posts?
- tag.php pagination and query_posts()
- Authors list Pagination?
- Add icons in paginate_links()
- How can I use var php with javascript to build custom page? [closed]
- WordPress single page template, custom post type, pagination orderby title – alphabetical order
- Single Page Views and Pagination View Depending on URL Query
- Category lists page foreach Paging
- Issue on single.php pagination WordPress
- Using Ajax in the prev_posts_link and next_posts_link
- Adding range to wp_link_pages()
- How to set up pagination [closed]
- Search page pagination does not work
- paged variable not working for category/custom post archive
- Wp pagination for custom database table
- Customise wp_List_pages to output a UL LI
- Custom wp_link_pages for paginated posts | Next page randomly
- Pagination in home page for a custom loop loads same content
- Pagination not working with custom post type
- Displaying the author of next and previous posts in pagination?
- How to ignore pagebreaks for RSS feed?
- Pagination For Table Rows on a page?
- The paging is very slow under a large number of articles
- Universal CPT archive template and half working pagination
- Home page Pagination – Other pages do not redirect to home page template
- Problem with older entries in homepage
- remove $_GET-parameter from WP_List_Table::tablenav
- Pagination for previous page/next page (with more than one post/page)
- Pagination for custom post types
- Pagination in author, category, archive and tags pages does not work
- WordPress pagination with wp_query_columns
- How can I paginate results from get_children
- Setting up Pagination with twentytwelve_content_nav
- Why can i add /page/674874 (or any number) to a URL and it still pulls up that page?
- How to add numbers pagination to this blog page?
- Show number of pagination pages even when total under two
- Why next_posts(); function does not work inside header.php?
- Override the WordPress default pagination markup
- Pagination with Metaboxes or Custom Fields
- The pagination is working on Local, not on LIVE. why?
- 2 Columns with Independent Pagination
- Prevent WordPress to remove query vars from url
- Add pagination to search.php page
- Google Indexed sub pages in wordpress pagination in post
- Paginate Links function: Page 1 doesn’t work
- Pagination doesn’t work on static front page
- Error 404 in Custom taxonomy with pagination
- How to display most viewed posts without any plugins
- Search engine not working
- Split a long form into multiple pages
- One post on frontpage and an archive page
- pagination for blog landing page
- homepage olderposts link showing page not found
- Pagination is not working correctly there is this wierd looping
- margins in between pagination links [closed]
- Page navigation not working correctly on index but only on categories
- How to split long posts in multiple pages in twentysixteen
- Duplicating pagination on second page
- Stop pagination when static homepage is set
- Is ‘pm’ used by core?