W3cubDocs

/WordPress

WP_Query::next_post(): WP_Post

Sets up the next post and iterate current post index.

Return

WP_Post Next post.

Source

public function next_post() {

	++$this->current_post;

	/** @var WP_Post */
	$this->post = $this->posts[ $this->current_post ];
	return $this->post;
}

Changelog

Version Description
1.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_query/next_post