[wp-trac] [WordPress Trac] #39992: Bug in get_the_content
WordPress Trac
noreply at wordpress.org
Tue Feb 28 21:01:17 UTC 2017
#39992: Bug in get_the_content
--------------------------+-----------------------------
Reporter: olik9 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.7.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
In get_the_content $post is not checked if it's null, after
{{{#!php
<?php
$post = get_post();
}}}
and then on line:
{{{#!php
<?php
if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( !
$multipage || $page == 1 ) )
}}}
as you see, $post->post_content is queried. Then if $post is null, the
program falls.
A solution can be to check:
{{{#!php
<?php
$post = get_post();
if ( ! $post ) { return ''; }
//else
}}}
and then continue.
Thank you for everything! :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39992>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list