• Resolved poodlerat

    (@poodlerat)


    When I type a single quote (‘) in a custom field, WordPress escapes it with a backslash (\). That backslash shows up when I display custom fields for my posts. Is there an easy way to get rid of this?

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Why are you using the single quote? Try using a character entity for it if all you want is ‘something like this’

    the character entity to use is for an apostrophe. If you want matching opening and closing ones, the left side one is

    otherwise, put the \ in before the single quotes you use yourself and see what happens.

    HTH

    Thread Starter poodlerat

    (@poodlerat)

    Thanks, but I really don’t see using curly quotes as a long-term solution. I want to be able to type a regular apostrophe (using the apostrophe key on my keyboard) without having to escape it. But the real problem is that when I do escape the apostrophe, the escape character shows up in the front end of WordPress!

    I know I can use character entities like ’ and ” as apostrophes and single and double quotes, but I don’t feel like I should have to.

    Thread Starter poodlerat

    (@poodlerat)

    Okay, I realized that if I want to type ordinary quotes (“) and apostrophes (‘) in custom fields, I just have to use stripslashes() when retrieving the data. (Because of the way I had my Write Post page set up, it took me a long time to realize this. Also, this only works if the text is entered in a textarea field rather than an input field.)

    If anyone else has this problem, I hope that helps!

    I’m having the same issue in WP 2.6…

    When I try to insert this into a custom field so the image shows up on a page:

    <img src=”http://www.bestgreenblogs.com/images/star30.gif”&gt;<img src=”http://www.bestgreenblogs.com/images/supporter.png&#8221; border=”0″ title=”This blogger donated to keep the independent green blogosphere alive!”>

    It shows up like this:
    <img src=\”http://www.bestgreenblogs.com/images/star30.gif\”><img src=\”http://www.bestgreenblogs.com/images/supporter.png\” border=\”0\” title=\”This blogger donated to keep the independent green blogosphere alive!\”>

    What do I do to make that not happen?

    This is definitely a bug in WP 2.6. There is an easy workaround, however, since it only occurs on an add operation. If you re-edit the field and press update – voila – no escapes.

    Ugh pain in the bum. Can this be fixed in the next update?

    I just created a blog and I have the excact same problem.

    I started a thread on opendesigns so if you haven’t found a solution keep an eye on that one.

    No-one found a fix for this yet?

    Not sure if this is old news, but I couldn’t find the answer so I’ve documented how to fix it on my (brand spanking new) blog

    how to fix wordpress double apostrophe problem
    http://www.markchicobaby.com/?p=5

    You need to set magic_quotes_gpc Off but if you’re running PHPsuexec then you need to follow my instructions. Hope it works for you.

    M

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Escape character inserted in custom fields’ is closed to new replies.