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

WordPress Trac noreply at wordpress.org
Tue Feb 18 17:08:25 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.4
Component:  Posts, Post Types                    |     Version:  5.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  refresh                                        |
-------------------------------------------------+-------------------------
Changes (by tessawatkinsllc):

 * Attachment "47824-tw.patch" added.

 Patches this defect by adding an optional $post parameter to function
 "the_content" that passes it to the function "get_the_content" since it
 was added since 5.2.0., and falls back to the global $post variable so it
 does not break when used outside "the loop".

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


More information about the wp-trac mailing list