This is an old question, but I needed the answer to this one as well. Here is the solution taken right from the WP codex…
$prev = '<div class="nav-previous">' . get_next_posts_link( __( '<span class="meta-nav">←</span> Previous' ), $loop->max_num_pages );
You need to append the max_num_pages parameter from the query to your output and it should work as expected from within the shortcode.
Related Posts:
- Shortcode Displaying Custom Post Types
- Next Post links not working in custom post type shortcode
- Where to put my code: plugin or functions.php?
- Pagination not working with custom loop
- WP_Query Pagination on single-custom.php
- wp_pagenavi() with custom wp_query()?
- Custom post type archive 404’s with paginate_links
- Custom permalink with pagination
- Custom wp_query pagination – next_posts_link() or wp_pagenavi() always empty
- Pagination with custom loop
- Group list of posts by taxonomy and allow for pagination
- Pagination on a custom page template
- Pagination problems with multiple custom post type archive pages
- posts_nav_link on single post template
- WP_Query pagination using only numbers instead of /page/1 on URL
- Pagination with custom post types results in 404 issues
- IF statement in a do_shortcode
- Custom query form submission pagination
- Paginated Taxonomy Term Archive including one post per term
- Strip shortcode from specific post types (formats)
- Pagination on Custom Post Type: 404 Error
- How to load custom post archives sub-pages with ajax?
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Get custom posts with certain ids in a custom loop using a shortcode
- Shortcode doesn’t display in custom post type
- Pagination on category page with custom post types
- Archive template for custom post type only lists first 10
- Add category attribute to custom shortcode
- How to create shortcode to display custom field value on a custom post type
- Pagination is not working in custom post type
- Custom post type not displaying all entries
- Get custom post type list for every category shortcode
- Custom post type (with parent-child relationship) singular page with pagination
- How do I move/order posts with a tag to the end?
- Add Pagination on Custom Post Type Archive
- Woocommerce search pagination not working
- How To Show All Custom Post Types In A Category Instead Of Pagination?
- Custom Post Type Pagination Paginates Only in URL Structure
- Shortcode for CPT post content in a page
- Custom post type pagination 404
- Pagination broken by naming conflict between CPT and Page
- Checking if looped item has a parent inside a shortcode
- Pagination Error : Duplicate argument being outputted
- get_post_meta is not working inside shortcode
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- How can I add a shortcode to query Custom Post Type with ACF in WordPress?
- Get Posts by Category, Tag , and CPT Taxonomy
- post_type internal ID?
- Pagination hitting 404 page on /page/4
- Using Pagination for Custom Post Type and keeps returning 404
- Pagination for search results of custom post type [duplicate]
- Pagination of custom post type leads to 404 error
- Shortcode / WP_Query in post changes context
- Custom Post Type or Shortcode, What to choose? [closed]
- Modify a plugin function output from another plugin
- Using Custom Post Meta Values in Shortcode
- All blog posts are not showing up
- Content in WP Editor displayed below CPT shortcode [duplicate]
- 2 custom post type paging in 1 custom taxonomy
- Sticky posts limit query and pagination for a custom post type
- Pagination in custom post type archive.php not working
- Alike Shortcode using in Custom Shortcode
- Shortcode with loop stacks output
- How to display the post using a shortcode in WordPress?
- Custom Post Type Pagination getting 404 error
- Numeric pagination custom post type
- How to generate auto shortcode for custom post type same as Elementor Template?
- Shortcode and get_template_part
- User Archive page for Custom Post Type – Pagination Issue
- Custom post pagination not working
- CPT/Taxonomy/Postname permalink structure makes pagination break
- How to get a custom post type archive paged when using a custom field for post sorting?
- Pagination in wp-admin for CPT
- 404 error next-page [2] PageNavi custom type taxonomy
- Add pagination to custom page
- Enable shortcodes on custom post type
- Custom meta box in editor of custom post type not working
- Pods pagination erases my sub menu
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- Get Non-Paginated Index of Post in Paginated Query
- Plugin Error on activating
- shortcode order for event custom post type
- Shortcode display CPT Query only showing 1 post?
- Custom post type archive pagination with HTML5Blank theme?
- Paginate custom taxonomy category with wp_custom_pagination
- Custom post type navigation on static page
- Custom pagination [duplicate]
- Using get_terms() as shortcode attribute
- Rewrite Rule & Regex – Extract ‘cat-name’ and ‘page-number’ from http://domain.com/custom-post-type/category/cat-name/page/page-number
- Using pagination with specific custom post type [duplicate]
- Pagination not working with custom loop
- how to limit query_post to first page?
- Pagination not working with custom loop
- Pagination not working with custom loop
- Fourth page of custom post type archive page does not exist
- Pagination broke after updateto WordPress 3.4 [duplicate]
- WordPress pagination URL
- How to Create Short Code Using Custom Post type
- the_post_navigation in single page with multiple taxonomies
- Problem with shortcode