Make WordPress Core

Opened 18 years ago

Closed 16 years ago

#6414 closed defect (bug) (invalid)

Inserting an image with an apostrophe in the title or caption results in \' in the HTML

Reported by: johnconners Owned by: andy
Priority: normal Milestone:
Component: Administration Version: 3.0.1
Severity: normal Keywords:
Cc: Focuses:

Description

If you insert an image into a post and have an apostrophe in the title or caption, such as:

Title: It's a title
Caption: It's a caption

Then the underlying HTML that ends up in the post will have the link's title attribute like so:

title="It\'s a title"

and the image's alt attribute as:

alt="It\'s a caption"

Note the addition of the backslash in both cases. This is as a result of the media_send_to_editor function (in wp-admin/includes/media.php) calling addslashes when it sends the HTML to the editor. I'm sure that addslashes is there for good reason so I suspect the fix might be somewhat trickier than simply removing the call.

Change History (16)

#1 @johnconners
18 years ago

  • Milestone 2.7

#2 @ryan
18 years ago

  • Owner changed from anonymous to andy

#3 @Nazgul
18 years ago

  • Milestone2.6

#4 @MichaelH
18 years ago

See different, but related, forum thread:
http://wordpress.org/support/topic/174164

#6 @tarasdi
18 years ago

Is this related to bug #6812?

#7 @tarasdi
18 years ago

Just tested this out on 2.6.2, and it seems to have been fixed..

#8 @johnconners
18 years ago

  • Resolutionfixed
  • Status newclosed

Yeah, this does indeed appear to have been fixed.

#9 @jacobsantos
18 years ago

  • Milestone 2.92.7
  • Resolution fixed
  • Status closedreopened

#10 @jacobsantos
18 years ago

  • Milestone 2.7
  • Resolutionworksforme
  • Status reopenedclosed

Should be moved to 2.6.2 if it was indeed fixed or if the behavior was changed naturally without knowledge of this ticket.

#11 @codecowboy
16 years ago

  • Cc codecowboy added
  • Resolution worksforme
  • Status closedreopened

#12 @codecowboy
16 years ago

This is still an issue in 3.0.1

When inserting a caption which requires apostrophe(s), you can insert it and update the post - the correct caption will be displayed on the public-facing post.

However, after updating the the post, the caption will not display correctly in either the visual editor or the media editor (it will be truncated at the first apostrophe). The temptation for a content editor is then to think that the caption is broken and re add it. Again, the editors do not display the updated caption.

http://core.trac.wordpress.org/ticket/6414#comment:11

#13 @codecowboy
16 years ago

  • Version 2.53.0.1

#14 @codecowboy
16 years ago

  • Resolutionfixed
  • Status reopenedclosed

apologies - this looks like it is related to the custom field templates plugin

#15 @scribu
16 years ago

  • Resolution fixed
  • Status closedreopened

#16 @scribu
16 years ago

  • Resolutioninvalid
  • Status reopenedclosed
Note: See TracTickets for help on using tickets.