Make WordPress Core

Opened 12 years ago

Closed 8 years ago

Last modified 7 years ago

#21007 closed defect (bug) (fixed)

Importing omits backslashes

Reported by: semekh's profile SeMeKh Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Import Keywords: has-patch
Focuses: Cc:


If you try to import a previously-exported post containing backslashes, those backslashes will be omitted during the import process.

Attachments (4)

importer.diff (1.5 KB) - added by SeMeKh 12 years ago.
Patch to fix the omitted-backslashes bug
21007.patch (511 bytes) - added by SergeyBiryukov 11 years ago.
21007.diff (4.9 KB) - added by boonebgorges 8 years ago.
21007.2.diff (2.0 KB) - added by ocean90 7 years ago.

Download all attachments as: .zip

Change History (15)

12 years ago

Patch to fix the omitted-backslashes bug

#1 @SeMeKh
12 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
12 years ago

  • Milestone changed from Awaiting Review to


#3 @SeMeKh
12 years ago

  • Keywords needs-testing added

The issue is about wordpress-import, I don't know if the same problem exists for other importers.

#4 @daveagp
11 years ago

This is basic functionality. The patch is simple and worked for me. It's a pseudo-official plugin that is linked to by core code so this is important. Please accept!

#5 @SeMeKh
11 years ago

18 months, and this isn't fixed yet. And the patch is already there!

What's wrong with Wordpress developers?

#6 @SergeyBiryukov
11 years ago

Since $postdata is a simple array, I guess we can just use array_map() here: 21007.patch.

8 years ago

#8 @boonebgorges
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Hi all - Sorry for the delay on this. It does appear to be a bug, for terms as well as for posts. See the tests in 21007.diff.

Fixed in This will be part of the next minor release.

#9 @boonebgorges
8 years ago

In 38283:

Add wordpress-importer tests demonstrating slashed data behavior.

See #21007.

#10 follow-up: @mcbsys
7 years ago

Not sure whether to post here or on Github.

In 0.6.3, backslashes are still being removed from comments. I'm not familiar with WordPress code but adding another wp_slash to wordpress-importer.php seemed to fix it:


if ( isset( $inserted_comments[$comment['comment_parent']] ) )
    $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
$comment = wp_slash( $comment );
$comment = wp_filter_comment( $comment );

7 years ago

#11 in reply to: ↑ 10 @ocean90
7 years ago

  • Keywords needs-testing removed

Replying to mcbsys:

Thanks for your PR. The fix will be part of the next minor version.

21007.2.diff includes a test to verify the issue and the fix.

Note: See TracTickets for help on using tickets.