Opened 15 years ago
Last modified 6 years ago
#12084 new enhancement
allow preserving HTML in the_excerpt (specify allowed tags for strip_tags in wp_trim_excerpt)
Reported by: | sillybean | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Formatting | Keywords: | has-patch needs-testing needs-refresh |
Focuses: | Cc: |
Description
Right now, wp_trim_excerpt
is destructive. You can filter it, but once tags are stripped, you can't get them back without recreating the excerpt from the raw input. It would be nice if theme developers had an option to preserve at least some of the HTML formatting when using excerpts as post teasers (see #9260).
Attachments (2)
Change History (7)
#1
@
15 years ago
- Summary changed from allow preserving HTML in the_excerpt (make strip_tags optional in wp_trim_excerpt) to allow preserving HTML in the_excerpt (specify allowed tags for strip_tags in wp_trim_excerpt)
#2
@
15 years ago
Second patch balances the tags after the excerpt has been truncated, which makes more sense. However, it can result in weirdness with the word count. Not sure how to get around that without some really painful regex.
This patch also preserves shortcodes in excerpts, which seems logical if we're allowing HTML.
Note: See
TracTickets for help on using
tickets.
Creates excerpt_tags filter for wp_trim_content