[wp-trac] [WordPress Trac] #42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284
WordPress Trac
noreply at wordpress.org
Thu Apr 11 21:36:14 UTC 2019
#42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284
-------------------------------------------------+-------------------------
Reporter: internetwerk | Owner:
| boonebgorges
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.2
Component: Posts, Post Types | Version: 4.5
Severity: normal | Resolution: fixed
Keywords: dev-feedback has-patch 2nd-opinion | Focuses:
php73 has-unit-tests |
-------------------------------------------------+-------------------------
Comment (by slamorte):
Replying to [comment:16 Cibulka]:
> In my case, it was a call to `get_the_excerpt()`, when the page had
none. I have fixed it roughly this way:
>
> global $post;
> $excerpt = !empty($post->post_excerpt) ? get_the_excerpt() : null;
>
> PHP 7.2 as well.
WordPress 5.0.3 and PHP 7.2 I had the same error when getting an empty
excerpt.
Fixed with your code.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42814#comment:103>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list