[wp-trac] [WordPress Trac] #36934: Use of get_the_excerpt($post) is broken if post has no excerpt and you are inside a loop
WordPress Trac
noreply at wordpress.org
Mon Aug 6 14:50:03 UTC 2018
#36934: Use of get_the_excerpt($post) is broken if post has no excerpt and you are
inside a loop
-------------------------------------------------+-------------------------
Reporter: magicroundabout | Owner: swissspidy
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: Future
| Release
Component: Formatting | Version: 4.5
Severity: normal | Resolution:
Keywords: has-patch needs-testing has-unit- | Focuses: template
tests dev-feedback |
-------------------------------------------------+-------------------------
Comment (by swissspidy):
@tofandel Although it might seem like an easy fix at first glance, the
issue is a bit more complex than that.
Looking at your code snippet, I can see that you replaced
`get_the_content()` with `$post->post_content`. This alone is a regression
as all the edge cases and filters from `get_the_content()` aren't being
applied anymore.
That's why `get_the_content()` needs to support a `$post` parameter as
well and why we need to get rid of all the global variables that function
uses.
Please check out [attachment:"36934.4.diff"] as the latest patch. It might
not apply cleanly anymore as it's a bit older, but the idea is unchanged.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36934#comment:53>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list