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

WordPress Trac noreply at wordpress.org
Sun Jun 21 10:29:08 UTC 2020


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

Comment (by SergeyBiryukov):

 In [changeset:"48113" 48113]:
 {{{
 #!CommitTicketReference repository="" revision="48113"
 Posts, Post Types: Simplify `test_setup_postdata_loop()`.

 The important part here is calling `the_content()` after setting up post
 data for another post without updating global `$post`.

 The `foreach()` loop is not necessary.

 Follow-up to [UT1289].

 See #47824, #24330.
 }}}

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


More information about the wp-trac mailing list