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)); ?>
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)); ?>