[wp-trac] [WordPress Trac] #9256: clean up the global variables when moving out of the loop
WordPress Trac
noreply at wordpress.org
Wed Aug 7 23:14:58 UTC 2013
#9256: clean up the global variables when moving out of the loop
-------------------------------------+------------------------
Reporter: aldolat | Owner: anonymous
Type: enhancement | Status: reopened
Priority: normal | Milestone: 3.7
Component: Query | Version: 2.7.1
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+------------------------
Changes (by wonderboymusic):
* milestone: Future Release => 3.7
Comment:
This is very interesting one - to not break anything, I added an argument
to `setup_postdata()` which will set the local var `$page` to `1` if there
is no pagination requested:
`function setup_postdata( $post, $paginate = true )`
The gist of this ticket:
1. You have a paginated post and you are on page 2
1. You make your own query for other posts anywhere else.
1. You call `setup_postdata()` on a post with 2 pages
1. You call `the_content()`
1. Page 2's content shows up for that post
[attachment:9256.2.diff 9256.2.diff] fixes that.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9256#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list