Warning: This function has been deprecated. Use next_post_link() instead.
next_post() WordPress Function
The next_post() function is used to display the next post in the WordPress loop. This function is used within the WordPress loop to display the next post in the sequence.
next_post( string $format = '%', string $next = 'next post: ', string $title = 'yes', string $in_same_cat = 'no', int $limitnext = 1, string $excluded_categories = '' ) #
Prints link to the next post.
Description
See also
Parameters
- $format
(string)(Optional)
Default value: '%'
- $next
(string)(Optional)
Default value: 'next post: '
- $title
(string)(Optional)
Default value: 'yes'
- $in_same_cat
(string)(Optional)
Default value: 'no'
- $limitnext
(int)(Optional)
Default value: 1
- $excluded_categories
(string)(Optional)
Default value: ''
Source
File: wp-includes/deprecated.php
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.0.0 | Use next_post_link() |
0.71 | Introduced. |