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.
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;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |