Make WordPress Core

Opened 17 years ago

Closed 16 years ago

#5604 closed defect (bug) (duplicate)

the_excerpt should strip style tags

Reported by: sunburntkamel's profile sunburntkamel Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: General Keywords: the_excerpt, flickr, style, has_patch, needs_testing
Focuses: 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 (2)

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

Download all attachments as: .zip

Change History (9)

#1 @sunburntkamel
17 years ago

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.

@sunburntkamel
17 years ago

patch wp_trim_excerpt to strip style and script tags completely

@sunburntkamel
17 years ago

patch wp_trim_excerpt to strip style and script tags completely

#2 @sunburntkamel
17 years ago

  • Component changed from Template to General
  • Keywords has_patch added

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

#3 @sunburntkamel
17 years ago

  • Keywords changed from the_excerpt flickr style has_patch to the_excerpt, flickr, style, has_patch

#4 @sunburntkamel
17 years ago

  • Keywords needs_testing added

#5 @filosofo
17 years ago

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.

#6 @sunburntkamel
17 years ago

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

#7 @azaozz
16 years ago

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

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

Note: See TracTickets for help on using tickets.