You should use the pre_get_posts
action to get the correct number of category pages and links.
The complete solution is explained here.
Related Posts:
- Five posts from a category in footer
- Function the_posts_pagination() not compatible with WP_Query arguments
- adding pagination to a foreach loop in wordpress
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- Pagination only showed when no category is set in wp_query
- Pagination when using wp_query?
- Find out total number of pages in global query on archive page?
- Post_count only shows the number of results per page
- WordPress Pagination Not Working – Always Showing First Pages Content
- get_query_var function not working at all
- get_query_var( ‘paged’ ) not working outside of homepage
- Pagination returns 404 after page 20
- Combining two wordpress queries with pagination is not working
- next_posts_link not working for loop called with ajax
- Why does pagination always break when used on any form of a home page?
- Pagination broken when merging search results with additional WP_Query
- Pagination is not working using WP_Query
- Transient pagination not working properly
- Woocommerce custom loop to show all the products [closed]
- How to bring specific post to front of wordpress loop?
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Intentionally exceed max_num_pages on main query without getting 404?
- Pagination 404 errors for author posts query on author.php
- Pagination problem after WP_Query with tag filtering
- Pagination stops at page 6
- Paginated HTML Sitemap
- How To Remove/hide some specific categories from two different categories widget from sidebar
- Pagination is broken and I need help fixing it
- Pagination on category page with custom post types
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- Create A Loop With A Variable Number of Posts For Each Bootstrap Row?
- Show all post for a given category
- The pagination on index.php doesn’t work on a first page
- paging in WP_Query on static page
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- pagination with numbers for WP_User_Query
- WordPress pagination not working using WP_Query
- Can we return all category (not post) with Custom Query Filter? [closed]
- Query posts intersecting tags and categories
- posts_per_page not working for first page of pagination
- Exclude Category filter from Portfolio section
- Pagination on static Posts page
- How to cache wp_query with pagination using transients?
- Pagination only won’t work in author template
- wp query error while paging the posts
- Pagination on template page for custom query redirecting to index.php
- Slider won’t work with custom query
- WP_Query with one category in args shows other categories
- How order posts from category by date and comment count?
- How to get posts by category and by choosing a taxonomy term?
- Paging + WP Query
- Getting the permalink to the latest post from a category
- What is wrong with my WP_Query Arguments?
- WP_Query custom order and pagination
- Unable to paginate a custom page query
- Query Not working as expected
- max_num_pages says 4, yet I am only able to navigate to the third page
- Paginate pages with dynamic query
- filter posts by meta key with pagination
- Trouble Making WP_Query paged
- Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y
- Ajax (jquery) wp_query pagination returns -1
- get_the_terms has strange result since version 6.0
- Filter sub-category from checkbox form
- `offset` WP_Query argument dont work via `pre_get_posts`
- paginate_links appearing on page but it doesn’t actually paginate – pagination on a static page with a dynamic `post_type` argument on a static page
- Pagination of custom page with custom fields query
- pre_get_posts pagination not working
- Pagination not working on archive.php template?
- 3 posts from each existing category on one page
- How to show specify category template for both parent and child category
- Pagination inside the blog page not working
- Pagination on archive.php not working?
- Custom Query Pagination not working on static front page
- WordPress search page pagination displaying but not functional
- Multiple values in WP_Query : category__and
- How to exclude posts by ID within a category/archive loop
- I have 3 categories, i want to display on a loop the last 3 of every category
- Paginated Post List on Front Page
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Pull posts from all categories if quantity is not met?
- Retrieving category pages from subcategory returns empty sets
- Pagination in WP_Query?
- Archive – Show Page Month Headers
- Query post Pagination Problem
- Pagination for custom query throws 404 errors on last pages [duplicate]
- Pagination is not working on custom query inside a custom home page template
- Pagination not working in some author pages
- How to add archives (with pagination) to page template?
- Ordering Custom WP_Query loop by meta key value with pagination
- Loop being strainge
- Pagination in custom query not working [duplicate]
- paginate_links() on page (shortcode output)
- query_posts problem – need help
- Duplicate posts showing up in loop using infinite scroll
- Pagination showing same posts despite changing page
- Pagination with Custom Post Type not working on index.php: I get a 404
- Pagination on custom post type not working
- Pagenavi with archive page
- I need to get all categories from a WP_Query