[wp-trac] [WordPress Trac] #42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284
WordPress Trac
noreply at wordpress.org
Fri Jan 12 06:33:28 UTC 2018
#42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284
--------------------------+------------------------------
Reporter: internetwerk | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 4.5
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Changes (by kraftbj):
* keywords: needs-patch => has-patch
* version: 4.9.1 => 4.5
* component: General => Formatting
Comment:
I see where you're going with this @dd32, but I think there's another
problem in play.
First, Jetpack is doing it wrong, yup. We should just ask for the excerpt
we want using Core functions (`get_the_excerpt( $post );`, which works as
of WP 4.5 outside of the loop. (
https://github.com/Automattic/jetpack/pull/8510 )
Second, noting `get_the_excerpt`'s relatively new ability to accept a post
argument, the default filter adds `wp_trim_excerpt`, which has not been
updated to accept this new usage of `get_the_excerpt`, so it'll error out
on it's own (or use the `global $post` data instead of the specified
`$post`.
Try running
{{{
$post = get_post( [ID of an attachment );
get_the_excerpt( $post );
}}}
and it'll error still.
Patch incoming. Marking as issue since 4.5 based on when the `$post` arg
was added to `get_the_excerpt`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42814#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list