Make WordPress Core

Changeset 45286

Timestamp:
05/04/2019 09:06:14 PM (5 years ago)
Author:
azaozz
Message:

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.

Location:
branches/5.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

    • Property svn:mergeinfo changed
      /trunk (added)merged: 45285
  • branches/5.2/src/wp-includes/class-wp-query.php

    r44966 r45286  
    42094209        $numpages     = $elements['numpages'];
    42104210
     4211
     4212
     4213
     4214
     4215
     4216
     4217
     4218
     4219
     4220
     4221
    42114222        return true;
    42124223    }
     
    42994310        }
    43004311
    4301         /**
    4302          * Fires once the post data has been setup.
    4303          *
    4304          * @since 2.8.0
    4305          * @since 4.1.0 Introduced `$this` parameter.
    4306          *
    4307          * @param WP_Post  $post The Post object (passed by reference).
    4308          * @param WP_Query $this The current Query object (passed by reference).
    4309          */
    4310         do_action_ref_array( 'the_post', array( &$post, &$this ) );
    4311 
    43124312        $elements = compact( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' );
    43134313
  • branches/5.2/tests/phpunit/tests/query/setupPostdata.php

    r42343 r45286  
    99
    1010    protected $global_data = array();
     11
     12
    1113
    1214    public function setUp() {
     
    417419    }
    418420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
    419441}
Note: See TracChangeset for help on using the changeset viewer.