[wp-trac] [WordPress Trac] #42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284

WordPress Trac noreply at wordpress.org
Wed May 30 18:15:25 UTC 2018


#42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284
-------------------------------+-----------------------
 Reporter:  internetwerk       |       Owner:  (none)
     Type:  defect (bug)       |      Status:  reopened
 Priority:  normal             |   Milestone:  4.9.8
Component:  Posts, Post Types  |     Version:  4.5
 Severity:  normal             |  Resolution:
 Keywords:  has-patch          |     Focuses:
-------------------------------+-----------------------

Comment (by juergen74):

 For me this seem to be a problem of Themes or Plugins calling the Function
 get_the_content() outside of the Loop.

 So if you call it outside the loop the global $pages = null

 There are some easy fixes for this error: Don't call the function from
 outside of the loop! :) And if you see a theme or plugin that is doing
 that, ask the developers to fix it.

 or we could check $pages for null and return an empty string right at the
 begining of the function.

 {{{
 function get_the_content( $more_link_text = null, $strip_teaser = false )
 {
         global $page, $more, $preview, $pages, $multipage;

         if (is_null($pages)) { return ''; }    // new line

         $post = get_post();

 ....
 }}}

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


More information about the wp-trac mailing list