previous_post_link() 和next_post_link() 应在the_content 滤器
代码没有任何错误,只是必须在过滤器中返回值,而不是打印。否则,我相信帖子链接应该在内容的开头。
previous_post_link() 和next_post_link() 打印输出,以便考虑使用get_previous_post_link() 和get_next_post_link().
function prevnext( $content ) {
$content .= \'<div>\' . get_previous_post_link() . \'-\' . get_next_post_link() . \'</div>\';
return $content;
}
add_action( \'the_content\', \'prevnext\', 4 );