Make WordPress Core

Opened 17 years ago

Closed 15 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's profile johnconners Owned by: andy's profile andy
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Administration Keywords:
Focuses: Cc:

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
17 years ago

  • Milestone 2.7 deleted

#2 @ryan
17 years ago

  • Owner changed from anonymous to andy

#3 @Nazgul
17 years ago

  • Milestone set to 2.6

#4 @MichaelH
17 years ago

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

#6 @tarasdi
17 years ago

Is this related to bug #6812?

#7 @tarasdi
17 years ago

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

#8 @johnconners
16 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Yeah, this does indeed appear to have been fixed.

#9 @jacobsantos
16 years ago

  • Milestone changed from 2.9 to 2.7
  • Resolution fixed deleted
  • Status changed from closed to reopened

#10 @jacobsantos
16 years ago

  • Milestone 2.7 deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

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
15 years ago

  • Cc codecowboy added
  • Resolution worksforme deleted
  • Status changed from closed to reopened

#12 @codecowboy
15 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
15 years ago

  • Version changed from 2.5 to 3.0.1

#14 @codecowboy
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

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

#15 @scribu
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#16 @scribu
15 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.