[wp-trac] [WordPress Trac] #9256: clean up the global variables when moving out of the loop

WordPress Trac noreply at wordpress.org
Wed Oct 29 02:31:39 UTC 2014


#9256: clean up the global variables when moving out of the loop
-------------------------+---------------------------
 Reporter:  aldolat      |       Owner:  boonebgorges
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  4.1
Component:  Query        |     Version:  2.7.1
 Severity:  normal       |  Resolution:  fixed
 Keywords:  has-patch    |     Focuses:
-------------------------+---------------------------
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"30085"]:
 {{{
 #!CommitTicketReference repository="" revision="30085"
 Improve global variable setting in `setup_postdata()`.

 `setup_postdata()` is responsible for setting a number of global variables
 that are used for post pagination (`$pages`, `$page`, `$nextpage`) and the
 generation of post excerpts (`$more`). These variables should be sensitive
 to
 the currently running instance of `WP_Query` - rather than the main query
 -
 so that these features work properly inside of secondary `WP_Query` loops.

 This changeset moves the logic of `setup_postdata()` into a method on
 `WP_Query`,
 and converts `setup_postdata()` to a wrapper.

 Props boonebgorges, wonderboymusic.
 See #25349.
 Fixes #9256, #20904.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/9256#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list