Fix Post Excerpt length when there's no excerpt and post content is used instead#61888
Fix Post Excerpt length when there's no excerpt and post content is used instead#61888kmanijak wants to merge 5 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Hi, Thanks for contributing; I don't have enough time to review at the moment but I do recall that excerpts have been an issue for sometime with multiple efforts to fix it; see #48598 (comment) and possibly #53570 and #49612 as well |
|
Closing this one as the issue needs a new PR that uses https://core.trac.wordpress.org/changeset/58065 to address this |
What?
Post Excerpt allows users to set the excerpt length in Editor (10 - 100 words). If a post has no excerpt, the post content is taken as a fallback. Post Content is truncated internally before reaching the Excerpt block to 55 words with default WordPress ellipsis:
[…]instead of Excerpts ellipsis….Check the screenshot below, the excerpt (pink background) length is set to 100 words:
Why?
In get_post_excerpt we read:
then in wp_trim_excerpt:
How?
Before calling
get_post_excerptwe call aexcerpt_lengthfilter and pass$excerpt_lengthattribute if set.Testing Instructions
Example content
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sed nibh blandit, sodales enim aliquet, ultricies ligula. Praesent enim lectus, gravida a sapien eget, venenatis tempor ligula. Etiam cursus, nisl id molestie rutrum, ex velit volutpat arcu, at blandit quam lectus ut urna. Sed at venenatis turpis, convallis laoreet ante. Nulla lobortis odio non est eleifend, eu vulputate arcu pharetra. Pellentesque porta ante non mauris rutrum consectetur. Quisque nulla neque, vestibulum sed consectetur eget, pellentesque quis felis. Nullam maximus felis neque, a efficitur velit venenatis vitae. Praesent elit sem, bibendum id malesuada sit amet, tristique non turpis. Vivamus varius venenatis sem auctor semper. Cras imperdiet risus diam, sit amet tincidunt dui dictum posuere.Duis ut tellus fermentum arcu efficitur posuere. Sed tincidunt, nulla a porttitor sagittis, felis felis condimentum felis, ut bibendum augue lacus eu orci. Vestibulum consequat condimentum viverra. Duis pharetra turpis vel varius malesuada. Quisque id velit id.
MAX NUMBER OF WORDSto 100Testing Instructions for Keyboard
Screenshots or screencast