This page redirects to an external site: https://developer.wordpress.org/reference/functions/next_post/
Languages: English • 日本語 (Add your language)
Used on single post/permalink pages, this tag lists the next post in chronological order from the current post. It can work in conjuntion with the previous_post() tag. This tag must be used in The Loop.
For the index, category, and archives templates, use the posts_nav_link() tag.
<code style="color: #000000"> <span style="color: #0000BB"><?php next_post</span><span style="color: #007700">(</span><span style="color: #DD0000">'format'</span><span style="color: #007700">, </span><span style="color: #DD0000">'next'</span><span style="color: #007700">, </span><span style="color: #DD0000">'title'</span><span style="color: #007700">, </span><span style="color: #DD0000">'in_same_cat'</span><span style="color: #007700">,
</span><span style="color: #0000BB">limitnext</span><span style="color: #007700">, </span><span style="color: #0000BB">excluded_category</span><span style="color: #007700">); </span><span style="color: #0000BB">?></span> </code>
By default, displays text "next post:" as link along with post title.
<?php next_post(); ?>
Displays specified text as link, without including the post title. If excessively long post titles break your layout, you may want to use this. "Next »" is the specified text in this example; you can put whatever you want.
<code style="color: #000000"> <span style="color: #0000BB"><?php next_post</span><span style="color: #007700">(</span><span style="color: #DD0000">'%'</span><span style="color: #007700">,</span><span style="color: #DD0000">'Next »'</span><span style="color: #007700">, </span><span style="color: #DD0000">'no'</span><span style="color: #007700">); </span><span style="color: #0000BB">?></span> </code>
Displays previous and next post links in the format with the text before the post title not shown as a link.
<p><?php previous_post('%', 'Previous:', 'no'); ?>
| <?php next_post('%', 'Next:', 'no'); ?></p>
To display text, like arrows («), at the beginning of the previous post link and at the end of the next post link so it looks like:
<?php previous_post('« « %', '', 'yes'); ?>
| <?php next_post('% » » ', '', 'yes'); ?>
See also previous_post().