Skip to content

Commit

Permalink
fix: phpcs error and update the logic for the next_post
Browse files Browse the repository at this point in the history
  • Loading branch information
Juzar10 committed Feb 5, 2025
1 parent 2dab8fa commit e271243
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/wp-includes/class-wp-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -3671,14 +3671,20 @@ public function next_post() {
$current_item = $this->posts[ $this->current_post ];

if ( $current_item instanceof WP_Post ) {
return $this->post = $current_item;
}
$this->post = $current_item;
} else {
if ( is_object( $current_item ) && property_exists( $current_item, 'ID' ) ) {
$this->post = get_post( $current_item->ID );

if ( is_object( $current_item ) && property_exists( $current_item, 'ID' ) ) {
return $this->post = get_post( $current_item->ID ) ?: $current_item;
if ( ! $this->post ) {
$this->post = $current_item;
}
} else {
$this->post = $current_item;
}
}

return $this->post = $current_item;
return $this->post;
}

/**
Expand Down

0 comments on commit e271243

Please sign in to comment.