This function has been deprecated. Use previous_post_link() instead.

previous_post( string $format = '%', string $previous = 'previous post: ', string $title = 'yes', string $in_same_cat = 'no', int $limitprev = 1, string $excluded_categories = '' )

Prints a link to the previous post.


Description

See also


Parameters

$format

(Optional)

Default value: '%'

$previous

(Optional)

Default value: 'previous post: '

$title

(Optional)

Default value: 'yes'

$in_same_cat

(Optional)

Default value: 'no'

$limitprev

(Optional)

Default value: 1

$excluded_categories

(Optional)

Default value: ''


Source

File: wp-includes/deprecated.php

function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {

	_deprecated_function( __FUNCTION__, 'WP-2.0.0', 'previous_post_link()' );

	if ( empty($in_same_cat) || 'no' == $in_same_cat )
		$in_same_cat = false;
	else
		$in_same_cat = true;

	$post = get_previous_post($in_same_cat, $excluded_categories);

	if ( !$post )
		return;

	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
	if ( 'yes' == $title )
		$string .= apply_filters('the_title', $post->post_title, $post->ID);
	$string .= '</a>';
	$format = str_replace('%', $string, $format);
	echo $format;
}


Changelog

Changelog
Version Description
WP-2.0.0 Use previous_post_link()
WP-1.5.0 Introduced. This function has been deprecated. Use previous_post_link() instead.