[wp-trac] [WordPress Trac] #54601: wp_insert_post function removes backslashes

WordPress Trac noreply at wordpress.org
Wed Dec 8 08:41:10 UTC 2021


#54601: wp_insert_post function removes backslashes
--------------------------+-----------------------------
 Reporter:  sweetheatmn   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 wp_insert_post function removes all backslashes from the post_title and
 post_content

 reproducing the issue:


 {{{
 $my_post = array(
                 'post_title'    =>  'test post \include',
                 'post_content'  => 'test content',

 );

 // Insert the post into the database
 $insert= wp_insert_post( $my_post );
 }}}

 Expected result: new post with title new post \inlude
 Returned result: new post with title new post include

 reproduce#2
 {{{
 $my_post = array(
                 'post_title'    =>  'test post \\include',
                 'post_content'  => 'test content',

 );

 // Insert the post into the database
 $insert= wp_insert_post( $my_post );
 }}}


 Expected result: new post with title new post \inlude
 Returned result: new post with title new post include

 not clearly sure if this is a defect or I'm doing something wrong

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54601>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list