next_post_link() actually creates an anchor tag, not just the URL.
Try something like below to just get the URL:
<?php echo get_permalink(get_adjacent_post(false,'',true)); ?>
Related Posts:
- Modify previous and next text from pagination links
- Add a class to links in the visual editor (how to get old dialog back)
- Getting paginate_links() ‘end_size’ to display none
- WordPress AJAX Pagination with query_posts
- How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- Static Frontpage Pagination – Custom loop
- I can’t fetch query parameters ($_GET parameters) with get_query_var
- Rewriting search and pagination base
- WooCommerce – Customer Order History Pagination
- Changing Link Attributes for Wp_Link_Pages
- Custom Loop Pagination on WordPress
- I want to remove the links from the term list returned by get_the_term_list
- Edit format of Paginate_Links()
- Pagenavi pagination via wp-query in functions.php showing same content for each page
- How to check if comments are paginated?
- get understrap pagination to work with custom query
- Filter link to existing content suggestion
- Customized title tag for each page in pagination?
- Add “last” and “first” to WordPress Comment Pagination Links
- Change links automatically to affiliate links
- WordPress get pagination on wpdb get_results
- Sorting Posts | Alphabetical Order
- Getting rid of role=”navigation” in the Home Page Pagination
- Page navigation not showing even tho it should
- How to get the Page Number of the Current Page in Single Post Pagination
- Shortcode return function with link href inside PHP
- How to properly insert a link to a template in WordPress?
- How can I add pagination and how can I change thumbnail size?
- Taxonomy linked to pages
- WP-PageNavi is showing the first page only
- How can I properly control the numbers and dots that appear in pagination?
- wordpress count link clicks by ip address
- Increase returned number/pages on pagination
- Adding nofollow to a PHP generated Nav
- Using loop pagination on single.php
- WordPress 3.2 query_posts and pagination, permalinks issue
- Unreadable pagination
- How to show all pages in blog navigation?
- get_terms pagination
- Changes in permalink structure in WordPress and how to apply to in-site links
- Search not showing all results
- Pagination in plugin’s backend
- PHP code to use on next & previouspage links
- Pagination for custom shop loop woocommerce
- How to get all author posts outside of author templates
- Make Current/Active Page Number a Link (WP_LINK_PAGES)
- How to get post permalink url without a href
- How to create pagination for users list using custom array?
- get_template_directory_uri() providing wrong path for img
- Custom Pagination is Broken
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- Pagination on Custom Post
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Prev/Next Links Broken on Static Front Page Pagination
- trouble with page_id & highlighting current page
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- the_posts_pagination() not working in wpquery
- ACF Repeater Pagination stopped working since upgrade to php7.2
- How to use the wpsnonce clone post link?
- Generating rel=”prev” and rel=”next” using filters
- Extract links from content
- Need help with Code Correction php+wordpress
- Custom query vars filters problem with pagination
- Passing parameter from the current URL to redirect to another url
- Wrapping shortcode content in a span or link
- how to remove replicating a tag inside loop?
- changing static link to relative link
- Apply filters when loading post via ajax
- Links in footer section
- offset and max_num_pages in pagination gallery
- How to change this internal image link parameter using PHP?
- rewrite_rule – working fine but broken for pagination
- problem with category menu, it doesn’t want to show link
- How to fix blank pagination links?
- WordPress pagination broken on blog page, working for search results page
- Make first child link default instead of its parent
- How to link a word comprised of a custom field with another?
- Pagination on Custom Loop
- How can i list all user registered on my website and have pagination [duplicate]
- Pagination not displaying
- WordPress post pagination on custom template not working
- Pagination in category.php not functioning
- Link to external page has wordpress blog-url inside
- PHP code for link with text
- How to add pagination for wordpress home page
- Pagination 404 on my index.php
- Infinite Scroll Plugin: How to first show 6 posts and then 2 posts thereafter with Infinite Scroll Plugin?
- Pagination not working properly
- paginate_links() returns NULL instead of the pagination links, but pagination is actually happening
- What does this if-statement do?: if($pages=’ ‘) {}
- Blog Posts not sorted and pagination not adjusted after filtering some category
- How to Set Page Pagination Using Ajax JQuery – WordPress
- Remove content links (internal and external), but exclude post at specific categories
- /page/2/ redirect to 404
- Why do I get a 404 error on my custom post type archive pagination?
- Custom post type removing /page/2/ from URL when trying to access it
- Pagination with WP_query giving same items in each page
- Remove links to the comments section
- How to get default variation ID (woocommerce)
- Category Attachment Pagination 404 Error on 2nd Page