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

---

# next_post( string $format, string $next, string $title, string $in_same_cat, int $limitnext = 1, string $excluded_categories )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#changelog)

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

This function has been deprecated since 2.0.0. Use [next_post_link()](https://developer.wordpress.org/reference/functions/next_post_link/)
instead.

Prints link to the next post.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#see-also)󠁿

 * [next_post_link()](https://developer.wordpress.org/reference/functions/next_post_link/)

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

 `$format`stringrequired

`$next`stringrequired

`$title`stringrequired

`$in_same_cat`stringrequired

`$limitnext`intoptional

Default:`1`

`$excluded_categories`stringrequired

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

    ```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;
    }
    ```

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

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#hooks)󠁿

 [apply_filters( ‘the_title’, string $post_title, int $post_id )](https://developer.wordpress.org/reference/hooks/the_title/)

Filters the post title.

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

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

Retrieves the next post that is adjacent to the current post.

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

Marks a function as deprecated and inform when it has been used.

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

Retrieves the full permalink for the current post or post ID.

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

Calls the callback functions that have been added to a filter hook.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/next_post/?output_format=md#)

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

| Version | Description | 
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Deprecated. Use [next_post_link()](https://developer.wordpress.org/reference/functions/next_post_link/)  | 
| [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%2Fnext_post%2F)
before being able to contribute a note or feedback.