[wp-trac] [WordPress Trac] #41579: Post_content / meta value unable to store slashed content
WordPress Trac
noreply at wordpress.org
Mon Aug 7 09:53:12 UTC 2017
#41579: Post_content / meta value unable to store slashed content
-------------------------------+-----------------------------
Reporter: Compute | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
Hi there,
In my plugin I'm storing data from another service. This service returns
regex data on how some fields are getting validated.
When saving these values to either post_content or a post meta the values
are getting slashed. I could save these are options but due to it being
specific to a post_type this does not make sense.
To test:
{{{
$regex = '(\b16-\d{3}\b)';
$post_id = wp_insert_post( [
'post_title' => 'Test regex',
'post_content' => $regex,
'post_type' => 'post',
] );
var_dump($regex);
echo '<br>';
var_dump( get_post($post_id )->post_content );
die();
}}}
Output:
{{{
string(14) "(\b16-\d{3}\b)"
string(11) "(b16-d{3}b)"
}}}
It seems like there is no way of skipping the current API from slashing
the values with wp_unslash.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41579>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list