Posts, Post Types: Avoid a PHP warning when get_the_content() is called outside of the loop.

This ensures that `$pages` and other globals are only used after they have been set up in `setup_postdata()`.

Follow-up to [44941].

Props tessawatkinsllc, dontdream, spacedmonkey, squarecandy, davidbaumwald, SergeyBiryukov.
Fixes #47824. See #42814.

git-svn-id: https://develop.svn.wordpress.org/trunk@48114 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-06-21 10:34:35 +00:00
parent a7264f196d
commit e8176a19e2
3 changed files with 13 additions and 2 deletions

View File

@@ -4275,7 +4275,7 @@ class WP_Query {
$numpages = $elements['numpages'];
/**
* Fires once the post data has been setup.
* Fires once the post data has been set up.
*
* @since 2.8.0
* @since 4.1.0 Introduced `$this` parameter.