[wp-trac] [WordPress Trac] #47824: get_the_content() still causes a PHP warning outside of the loop

WordPress Trac noreply at wordpress.org
Thu Aug 8 01:32:41 UTC 2019


#47824: get_the_content() still causes a PHP warning outside of the loop
---------------------------------------------+---------------------
 Reporter:  SergeyBiryukov                   |       Owner:  (none)
     Type:  defect (bug)                     |      Status:  new
 Priority:  normal                           |   Milestone:  5.3
Component:  Posts, Post Types                |     Version:  5.2
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+---------------------

Comment (by SergeyBiryukov):

 Replying to [comment:4 spacedmonkey]:
 > Why not add a isset check for the globals then around the 281 line and
 run generate_postdata to make sure they do exist?

 That's an option too. They should always be set up in the loop, though, so
 just checking for `in_the_loop()` seems simpler.

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


More information about the wp-trac mailing list