Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7346 closed defect (bug) (duplicate)

using custom fields interjects back-slash?

Reported by: Lilith70 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:


When I use custom fields (latest_home_image and thumb_home_image) to format and display images from the Flickr account, back-slashes \ are interjected in front of every quotation mark, rendering the code useless unless edited by hand. Luckily, this does work using the Update button, but it's not exactly convenient.

Attachments (1)

7346.patch (671 bytes) - added by jamescollins 7 years ago.
Patch for WP 2.6.2 (revision 8852)

Download all attachments as: .zip

Change History (6)

#1 @The_Tim
7 years ago

I can confirm experiencing this problem with all versions since 2.6.

To recreate, type any value in a new custom field that includes single or double-quotes (' or "). When it is saved, it will be saved with a preceding backslash

' becomes \'
" becomes \"

It's pretty annoying, and only just began with version 2.6.

#2 @AaronCampbell
7 years ago

I'll try to take a look at this when I get time. If it's a bug, it would be nice to have a patch before 2.7 is put into freeze.

#3 @jamescollins
7 years ago

I can confirm that this bug occurs in WP 2.6.2.

When adding a custom field to a post, if the field's value contains an apostrophe or quotation mark (' or "), slashes are added to the wp_postmeta record.

There must be an extra addslashes() call somewhere before the INSERT statement.

Updating an existing custom field's value does not add extra slashes.

#4 @DD32
7 years ago

  • Milestone 2.7 deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 2.6 deleted

Duplicate: #7768 (Yes, This ticket is older, however theres a patch on the other one)

7 years ago

Patch for WP 2.6.2 (revision 8852)

#5 @jamescollins
7 years ago

Oops, never mind. Didn't notice the other ticket with an already existing patch.

DD32, your patch looks better than mine.

Note: See TracTickets for help on using tickets.