WP_Query::next_post() WordPress Method

The WP_Query::next_post() method is used to advance the internal pointer in a WP_Query object, and return the next post object.

WP_Query::next_post() #

Set up the next post and iterate current post index.


Return

(WP_Post) Next post.


Top ↑

Source

File: wp-includes/class-wp-query.php

	public function next_post() {

		$this->current_post++;

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


Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More