[wp-trac] [WordPress Trac] #6414: Inserting an image with an apostrophe in the title or caption results in \' in the HTML

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 27 13:26:06 GMT 2008


#6414: Inserting an image with an apostrophe in the title or caption results in \'
in the HTML
----------------------------+-----------------------------------------------
 Reporter:  johnconners     |       Owner:  anonymous
     Type:  defect          |      Status:  new      
 Priority:  normal          |   Milestone:  2.7      
Component:  Administration  |     Version:  2.5      
 Severity:  normal          |    Keywords:           
----------------------------+-----------------------------------------------
 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.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6414>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list