WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 3 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
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)

comment:1 johnconners6 years ago

  • Milestone 2.7 deleted

comment:2 ryan6 years ago

  • Owner changed from anonymous to andy

comment:3 Nazgul6 years ago

  • Milestone set to 2.6

comment:4 MichaelH6 years ago

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

comment:6 tarasdi6 years ago

Is this related to bug #6812?

comment:7 tarasdi6 years ago

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

comment:8 johnconners5 years ago

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

Yeah, this does indeed appear to have been fixed.

comment:9 jacobsantos5 years ago

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

comment:10 jacobsantos5 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.

comment:11 codecowboy3 years ago

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

comment:12 codecowboy3 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

comment:13 codecowboy3 years ago

  • Version changed from 2.5 to 3.0.1

comment:14 codecowboy3 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

comment:15 scribu3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:16 scribu3 years ago

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