[wp-hackers] slashes in custom field input
DD32
wordpress at dd32.id.au
Fri Sep 19 11:09:15 GMT 2008
Ahhh.. ok yes, That makes more sense :)
Sounds like the adding of the post meta isnt deslashing it, What are you
running? 2.6 or 2.7?
On Fri, 19 Sep 2008 21:02:58 +1000, Rick Beckman <rick.beckman at gmail.com>
wrote:
> Glad I'm not the only one up at this hour. Here's a better rundown of it:
>
> In a post, I add this as a custom field:
> This, "that," and 'the other.'
>
> After I click "Add Custom Field" and the field moves up to the list of
> already added fields, it appears like this:
> This, \"that,\" and \'the other.\'
>
> Outputting that content as a meta field in my post -- utilizing
> attribute_escape() to preserve the quotes -- I get this:
> <meta name="description" content="This, \"that,\" and
> \'the other.\'" />
>
> Which is fine, of course, except for the slashes which were never
> removed. I know I can easily strip slashes in my template file, and I
> can also easily remove them from the custom field after the initial
> adding of it.
>
> However, it just seems like they shouldn't be present at all after
> pressing "Add Custom Field." Subsequent edits of the custom field
> doesn't generate any extraneous slashes, after all.
>
>
> --
> Rick Beckman
> http://rickbeckman.org/
> http://fellowship-hall.com/
>
>
> On Fri, Sep 19, 2008 at 6:53 AM, DD32 <wordpress at dd32.id.au> wrote:
>>
>> Quick question:
>> Are you saying that the output from attribute_escape() ends up with ' "
>> and & with slashes? Or that the raw output from get_post_meta()
>> contains the slashes?
>>
>> On Fri, 19 Sep 2008 20:48:02 +1000, Rick Beckman
>> <rick.beckman at gmail.com> wrote:
>>
>>> I'm attempting to use custom fields to handle post descriptions
>>> instead of
>>> installing one of a thousand SEO plugins to do it, and while the theme
>>> output mechanism was dead-simple for even a lightweight like me to put
>>> together, I notice that whenever I add a custom field, the value that
>>> is
>>> saved has slashes added to entities such as ", ', and &.
>>>
>>> I'm already attribute_escape()ing the custom field output so that I
>>> can use
>>> quotes and ampersands within it without it breaking my HTML.
>>>
>>> It seems like WP should be stripping the slashes added by what I can
>>> only
>>> assume is the Ajax mechanism for first adding the field to a post.
>>> Subsquently editing and saving the value doesn't seem to add slashes
>>> anymore.
>>>
>>> Has anyone else noticed this?
>>>
>>>
>>> --
>>> Rick Beckman
>>> http://rickbeckman.org/
>>> http://fellowship-hall.com/
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list