[wp-hackers] What is the logic on stripping slashes on add_post_meta?

DD32 wordpress at dd32.id.au
Thu Feb 12 21:23:30 GMT 2009


The logic is as follows:
Originally, The code which is used for meta, was in theform for
adding-meta directly from the post screen, It was carried across to
the API functions.
WordPress addslashes() to all $_POST data (stupidly IMO), so the raw
meta handling functions expect the input to be slashed (As they're
originally just  admin template code).

IMO, add_post_meta should be updated to take a non-slashed input, but
then, theres backwards compat issues with those which pass a slashed
input in..

2009/2/13 Ozh <ozh at planetozh.com>:
>>(...) when people use my plugin on a
>>Windows host that uses '\' as directory seperaters. It turns
>>"C:\folder\subfolder" into "C:foldersubfolder".
>
> As a general rule in my plugins I always str_replace('\\', '/') every
> string that can contain a path, even WP consts and vars such as
> TEMPLATEPATH. Saves a lot of troubles and always work no matter what OS is
> running.
>
> Ozh
>
>
>
> _______________________________________________
> 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