Ticket #5604 (closed defect (bug): duplicate)

Opened 4 years ago

Last modified 4 years ago

the_excerpt should strip style tags

Reported by: sunburntkamel Owned by: anonymous
Priority: normal Milestone:
Component: General Version: 2.5
Severity: normal Keywords: the_excerpt, flickr, style, has_patch, needs_testing
Cc:

Description

the_excerpt prints <style> tags, rather than omitting them, causing unattractive excerpts.

example:  http://archgfx.net/wordpress/?cat=1

the problem usually comes up in the context of posting from flickr.

Attachments

formatting.php.5604.patch Download (984 bytes) - added by sunburntkamel 4 years ago.
patch wp_trim_excerpt to strip style and script tags completely
formatting.php.5604.diff Download (801 bytes) - added by sunburntkamel 4 years ago.
patch wp_trim_excerpt to strip style and script tags completely

Change History

it seems like wp_trim_excerpt might need something like this:  http://us.php.net/manual/en/function.strip-tags.php#71962 but i'm really not qualified to make a patch.

patch wp_trim_excerpt to strip style and script tags completely

patch wp_trim_excerpt to strip style and script tags completely

  • Keywords has_patch added
  • Component changed from Template to General

ignore the first patch, my tabs weren't set correctly.

  • Keywords the_excerpt, flickr, style, added; the_excerpt flickr style removed
  • Keywords has_patch, needs_testing added; has_patch removed

I think filtering out everything between style tags (and CDATA) is a good idea, but it should probably be done for the content_save_pre filter, as this can also be a problem when someone posts by email, for example.

I'm not sure that style/script tags should be removed from the posts entirely, as that might cause posts to not display properly.

  • Status changed from new to closed
  • Resolution set to duplicate
  • Milestone 2.5 deleted

Closing as duplicate of #6380. The patches are very similar too.

Note: See TracTickets for help on using tickets.