[wp-trac] [WordPress Trac] #41579: Post_content / meta value unable to store slashed content

WordPress Trac noreply at wordpress.org
Mon Aug 7 10:00:12 UTC 2017


#41579: Post_content / meta value unable to store slashed content
-------------------------------+----------------------
 Reporter:  Compute            |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:  invalid
 Keywords:                     |     Focuses:
-------------------------------+----------------------
Changes (by ocean90):

 * status:  new => closed
 * version:  trunk =>
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hello @Compute,

 by default `wp_insert_post()` doesn't add slashes to the post data because
 it '''expects''' the data already to be slashed. Before the data gets
 stored into the database `wp_unslash()` is called. That's why the slashes
 from the regex are removed.
 To solve this you have to call `wp_slash()` on your `$regex` first.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41579#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list