See the example on next_posts_link
in Codex. You have to pass the max_num_pages
to the function, otherwise it uses the value from the global $wp_query
, which is no longer the correct query object now that you’ve created a custom query object.
next_posts_link( 'load more', $work_posts->max_num_pages );
Related Posts:
- Pagination Not working on Home Page with 2 Query
- Cutom wp_query for geolocation search, pagination not working
- Adding pagination to sub-wp_query within a singular post page
- How to set up pagination for a custom loop on a global template (author.php, tag.php, archive.php?)
- WP_Query breaks pagination
- Pagination problem with multiple loops on the same page
- Nested meta_query with multiple relation keys
- Find out total number of pages in global query on archive 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
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- WP_Query and Pagination on a Static front page
- next_posts_link not working for loop called with ajax
- Pagination shows 404 after a certain number of pages
- Pagination/infinite scroll with WP_Query and multiple loops
- WP_query and pagination?
- pagenavi with merged wp_query [duplicate]
- Pagination not working on Custom Page Template
- Query with pre_get_posts to get pagination
- Get number of comments after modifying comment query
- Pagination is not working using WP_Query
- Transient pagination not working properly
- Injecting content with $wp_query->current_post restarts from zero on paged pages. How to inject content after X posts, regardless of pagination?
- Woocommerce custom loop to show all the products [closed]
- How to bring specific post to front of wordpress loop?
- Merged two WP_Queries, posts per page and pagination not working
- Pagination 404 errors for author posts query on author.php
- $wpdb->insert inserting two rows in database
- Pagination problem after WP_Query with tag filtering
- Pagination stops at page 6
- Paginated HTML Sitemap
- Posts loop with pagination on a single post page
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- Create unique page without header.php for json feed
- Pagination is broken and I need help fixing it
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- Five posts from a category in footer
- Is there any advantage of using default WordPress Search instead of creating a custom one?
- Clean up WordPress code that repeats
- paging in WP_Query on static page
- pagination with numbers for WP_User_Query
- posts_per_page not working for first page of pagination
- Pagination inside of a edit page
- WP Query to have sticky posts first, with pagination and having a joint ‘posts per page’ arg with main loop
- Pagination on static Posts page
- How do I get my custom query to work with search results after the first page?
- How to cache wp_query with pagination using transients?
- Removing duplicate values between two wordpress queries
- wp query error while paging the posts
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Pagination on template page for custom query redirecting to index.php
- Yoast primary category query modification
- How to order posts on each different category?
- Pagination in html table is not working
- Paging + WP Query
- WP_Query custom order and pagination
- Custom wp_query – I’m getting ‘all’ post, not the specific post in the query
- Unable to paginate a custom page query
- Query Not working as expected
- WP_query paged pagination with excluded category still counts it
- meta_query with array as value with multiple arrays
- max_num_pages says 4, yet I am only able to navigate to the third page
- Paginate pages with dynamic query
- Determining what post is displayed out of total posts found
- Trouble Making WP_Query paged
- How to make a query returning pages from multiple parents
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- 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
- pre_get_posts pagination not working
- WordPress Sub Category Archive, Show Extra Empty Page Number in Pagination
- Pagination unique to a widget
- Why pagination is not working with tax_query param?
- paginate_links method doesn’t show second page of my custom wp_query
- Wp_Query Post per page not working?
- Pagination Shows Up But Won’t Work on Custom Gallery Page
- Combine WP_Query with array of custom data to single loop without breaking the pagination
- Pagination returns 404 after page 20
- WP_Query with Pagination and orderby meta_value_num showing duplicates
- Archive – Show Page Month Headers
- Horizontally paginate through sets of blog posts?
- Pagination error WordPress multiple loop
- Comments orderby comment date not working
- Pagination With Custom WP Query not functioning
- Ordering Custom WP_Query loop by meta key value with pagination
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Pagination in custom query not working [duplicate]
- paginate_links() on page (shortcode output)
- WordPress Post Looping? [duplicate]
- Paginate wp_query while utilizing post__not_in
- Get next post when using pagination with WP_Query?
- Duplicate posts showing up in loop using infinite scroll
- Pagination showing same posts despite changing page
- shortcode with $atts with strange results
- Pagination on custom post type not working
- Show number of posts AND number on current page (cannot make it work)
- Limit paginated result set to a maximum number of posts