WordPress函数:next_post_link 显示下一篇文章链接

江河/ 2023年05月18日/ WordPress/ 浏览 623

函数原型:


next_post_link( string $format = '%link »', string $link = '%title', bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' )


函数源码:


function next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
	echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
}


可以看出函数 next_post_link 就是在函数 get_next_post_link 签名加了个 echo。


而函数 get_next_post_link 内部又是调用函数 get_adjacent_post_link。就像俄罗斯套娃一样。


参考文章:


《WordPress函数:get_next_post_link 获取下一篇文章的链接》


《WordPress函数:get_adjacent_post_link 获取相邻(上一篇下一篇)文章链接》


发表评论

暂无评论,抢个沙发...

客服 工单