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

WordPress Trac noreply at wordpress.org
Sat Dec 11 08:38:14 UTC 2021


#54601: wp_insert_post function removes backslashes
-------------------------------+------------------------------
 Reporter:  sweetheatmn        |       Owner:  (none)
     Type:  defect (bug)       |      Status:  reopened
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  close              |     Focuses:
-------------------------------+------------------------------
Changes (by sweetheatmn):

 * status:  closed => reopened
 * resolution:  invalid =>


Comment:

 I don't think your decision is correct

 at least what you state will get removed as for sanitization does not get
 really stripped

 can you just test it?

 I did test what you call will get stripped and only the \ was removed from
 the post content and why at all will a bracket or & will ever get stripped
 from the added post content

 please reopen the case


 {{{
 //wp-load
 require_once('../../../wp-load.php');

 $my_post = array(
                 'post_title'    =>  'test [&<>"\'] post \include',
                 'post_content'  => 'test content',

 );



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

 }}}

 returned title test [&<>"'] post include
 exptected title test [&<>"\'] post \include

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


More information about the wp-trac mailing list