admin管理员组文章数量:1287598
how can I get a pagination link URL instead of a made-up anchor link? currently, I used
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
for pagination but it returns a
, I want to know is there any way to get just the next/prev URL?
how can I get a pagination link URL instead of a made-up anchor link? currently, I used
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
for pagination but it returns a
, I want to know is there any way to get just the next/prev URL?
- 2 Please have look if this helps: wordpress.stackexchange/questions/57831/… – jas Commented Dec 4, 2015 at 17:50
2 Answers
Reset to default 10If you check out the source, they're both wrappers around *_posts()
, which in turn are wrappers for get_*_posts_page_link()
(where the wildcard indicates either next
or previous
).
For example, next_posts()
will echo or return the escaped URL, depending on the first argument:
$escaped_url = next_posts( false /* Don't echo */ );
next_posts(); // Prints escaped URL
Otherwise you can get the raw URL with get_next_posts_page_link()
and do with it as you wish:
$raw_url = get_next_posts_page_link();
wp_redirect( $raw_url );
// or...
echo esc_url( $raw_url );
There are get_previous_posts_link()
and get_next_posts_link()
, they should do what you want.
本文标签: how to get pagination link url
版权声明:本文标题:how to get pagination link url? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741296187a2370832.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论