Opened 3 years ago

Closed 3 years ago

#12651 closed defect (bug) (fixed)

$pages global not updated with multiple WP_Query objects/post loops

Reported by: misterbisson Owned by: ryan
Priority: normal Milestone: 3.0
Component: Query Version:
Severity: normal Keywords: has-patch
Cc:

Description

setup_postdata() in wp-includes/query.php globalizes the $pages var, then assigns it to either $pages = explode(...) or $pages[0] = $post->post_content depending on whether the $post->post_content is paginated.

However, the var is not properly reset when displaying posts in additional post loops on a given page that is paginated. As coded, only $pages[0] is reset, leaving other elements of the array unchanged. The attached patch corrects the problem.

Attachments (1)

postdata-fix.diff (361 bytes) - added by misterbisson 3 years ago.

Download all attachments as: .zip

Change History (4)

  • Component changed from General to Query
  • Keywords has-patch added
  • Owner set to ryan
  • Milestone changed from Unassigned to 3.0

comment:3   ryan3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14750]) Fix pages setup in setup_postdata(). Props misterbisson. fixes #12651

Note: See TracTickets for help on using tickets.