next_post( string $format = '%', string $next = 'next post: ', string $title = 'yes', string $in_same_cat = 'no', int $limitnext = 1, string $excluded_categories = '' )
- Since
- 0.71
- Source
wp-includes/deprecated.php:173
Prints link to the next post.
Parameters
$formatstringoptional- Default:
'%' $nextstringoptional- Default:
'next post: ' $titlestringoptional- Default:
'yes' $in_same_catstringoptional- Default:
'no' $limitnextintoptional- Default:
1 $excluded_categoriesstringoptional- Default:
''
Hooks fired · 1
One hook fires while next_post() runs, in this order:
Uses · 4
- _deprecated_function()Marks a function as deprecated and inform when it has been used.
- get_next_post()Retrieves the next post that is adjacent to the current post.
- get_permalink()Retrieves the full permalink for the current post or post ID.
- apply_filters()Calls the callback functions that have been added to a filter hook.
Source
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { _deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' ); if ( empty($in_same_cat) || 'no' == $in_same_cat ) $in_same_cat = false; else $in_same_cat = true; $post = get_next_post($in_same_cat, $excluded_categories); if ( !$post ) return; $string = '<a href="'.get_permalink($post->ID).'">'.$next; if ( 'yes' == $title ) $string .= apply_filters('the_title', $post->post_title, $post->ID); $string .= '</a>'; $format = str_replace('%', $string, $format); echo $format;}History
Introduced in 0.71. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
2.0.0
Deprecated. Use next_post_link()from the docblock
0.71
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/deprecated.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.