next_post

The timeline below displays how wordpress function next_post has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 4.6

/**
 * Prints link to the next post.
 *
 * @since 0.71
 * @deprecated 2.0.0 Use next_post_link()
 * @see next_post_link()
 *
 * @param string $format
 * @param string $next
 * @param string $title
 * @param string $in_same_cat
 * @param int $limitnext
 * @param string $excluded_categories
 */
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;
}

WordPress Version: 4.4

/**
 * Prints link to the next post.
 *
 * @since 0.71
 * @deprecated 2.0.0 Use next_post_link()
 * @see next_post_link()
 *
 * @param string $format
 * @param string $next
 * @param string $title
 * @param string $in_same_cat
 * @param int $limitnext
 * @param string $excluded_categories
 */
function next_post($format = '%', $next = 'next post: ', $title = 'yes', $in_same_cat = 'no', $limitnext = 1, $excluded_categories = '')
{
    _deprecated_function(__FUNCTION__, '2.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;
}

WordPress Version: 3.9

/**
 * Prints link to the next post.
 *
 * @since 0.71
 * @deprecated 2.0.0
 * @deprecated Use next_post_link()
 * @see next_post_link()
 *
 * @param string $format
 * @param string $next
 * @param string $title
 * @param string $in_same_cat
 * @param int $limitnext
 * @param string $excluded_categories
 */
function next_post($format = '%', $next = 'next post: ', $title = 'yes', $in_same_cat = 'no', $limitnext = 1, $excluded_categories = '')
{
    _deprecated_function(__FUNCTION__, '2.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;
}

WordPress Version: 3.7

/**
 * Prints link to the next post.
 *
 * @since 0.71
 * @deprecated 2.0
 * @deprecated Use next_post_link()
 * @see next_post_link()
 *
 * @param string $format
 * @param string $next
 * @param string $title
 * @param string $in_same_cat
 * @param int $limitnext
 * @param string $excluded_categories
 */
function next_post($format = '%', $next = 'next post: ', $title = 'yes', $in_same_cat = 'no', $limitnext = 1, $excluded_categories = '')
{
    _deprecated_function(__FUNCTION__, '2.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;
}