Title: previous_posts
Published: April 25, 2014
Last modified: February 24, 2026

---

# previous_posts( bool $display = true ): string|void

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#wp--skip-link--target)

Displays or retrieves the previous posts page link.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#parameters)󠁿

 `$display`booloptional

Whether to echo the link.

Default:`true`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#return)󠁿

 string|void The previous posts page link if `$display = false`.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#source)󠁿

    ```php
    function previous_posts( $display = true ) {
    	$output = esc_url( get_previous_posts_page_link() );

    	if ( $display ) {
    		echo $output;
    	} else {
    		return $output;
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/link-template.php#L2651)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/link-template.php#L2651-L2659)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#related)󠁿

| Uses | Description | 
| [get_previous_posts_page_link()](https://developer.wordpress.org/reference/functions/get_previous_posts_page_link/)`wp-includes/link-template.php` |

Retrieves the previous posts page link.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  |

| Used by | Description | 
| [get_previous_posts_link()](https://developer.wordpress.org/reference/functions/get_previous_posts_link/)`wp-includes/link-template.php` |

Retrieves the previous posts page link.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/previous_posts/?output_format=md#changelog)󠁿

| Version | Description | 
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fprevious_posts%2F)
before being able to contribute a note or feedback.