Fix `setup_postdata()` to set the (inside the loop) globals before `the_post` action is fired. Follow-up from #42814 and [44941].

Props david.binda, spacedmonkey, boonebgorges, birgire, jorbin, azaozz.
Merges [45285] from trunk.
Fixes #47114 for 5.2.


Built from https://develop.svn.wordpress.org/branches/5.2@45286


git-svn-id: http://core.svn.wordpress.org/branches/5.2@45095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2019-05-04 21:08:18 +00:00
parent 762573a32e
commit dd6391bb09
2 changed files with 12 additions and 12 deletions

View File

@ -4208,6 +4208,17 @@ class WP_Query {
$more = $elements['more'];
$numpages = $elements['numpages'];
/**
* Fires once the post data has been setup.
*
* @since 2.8.0
* @since 4.1.0 Introduced `$this` parameter.
*
* @param WP_Post $post The Post object (passed by reference).
* @param WP_Query $this The current Query object (passed by reference).
*/
do_action_ref_array( 'the_post', array( &$post, &$this ) );
return true;
}
@ -4298,17 +4309,6 @@ class WP_Query {
$multipage = 0;
}
/**
* Fires once the post data has been setup.
*
* @since 2.8.0
* @since 4.1.0 Introduced `$this` parameter.
*
* @param WP_Post $post The Post object (passed by reference).
* @param WP_Query $this The current Query object (passed by reference).
*/
do_action_ref_array( 'the_post', array( &$post, &$this ) );
$elements = compact( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' );
return $elements;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-RC2-45280';
$wp_version = '5.2-RC2-45286';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.