Make WordPress Core

Opened 7 months ago

Closed 6 months ago

Last modified 6 months ago

#46575 closed defect (bug) (fixed)

Issue with WP Export - adding spaces to .xml file

Reported by: juliarrr Owned by: SergeyBiryukov
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.1
Component: Export Keywords: has-patch
Focuses: Cc:
PR Number:



After updating WordPress to 5.1 (or 5.1.1) appeared bug with exporting content. When proceeding to the Tools - Export and downloading export .xml file, it can be seen that it exports content incorrectly. Spaces before and after content are added, and it causes problems with importing this content afterwhile. On the screenshot you can see the difference - content on the left was exported on WP 5.0 and content on the right was exported on WP 5.1: https://www.screencast.com/t/jovdKo4Cw . As you can see there are unneeded spaces that break the content structure after import.

Please fix this problem in the next WP update.
Thank you!

Attachments (1)

46575.diff (759 bytes) - added by sgastard 7 months ago.
Remove blank

Download all attachments as: .zip

Change History (11)

7 months ago

Remove blank

#1 @sgastard
7 months ago

  • Keywords has-patch added

#2 @sgastard
7 months ago

#46656 was marked as a duplicate.

#3 @aristath
7 months ago

  • Component changed from General to Export

Just to add to this, this is not limited to <title> elements. As mentioned on https://core.trac.wordpress.org/ticket/46656 the coding-standards fixes in https://core.trac.wordpress.org/changeset?old_path=%2Ftags%2F5.0.3%2Fsrc%2Fwp-admin%2Fincludes%2Fexport.php&old=45013&new_path=%2Ftags%2F5.1.1%2Fsrc%2Fwp-admin%2Fincludes%2Fexport.php&new=45013&sfp_email=&sfph_mail=#file0 result in a lot of whitespace that breaks things on imports - both for menu items as well as content using any page-builder.
It's really annoying having to manually edit the exported XMLs to remove whitespace before importing them on another site - and I'm sure not everyone can do that.

#4 @SergeyBiryukov
6 months ago

#46904 was marked as a duplicate.

#5 @SergeyBiryukov
6 months ago

  • Milestone changed from Awaiting Review to 5.2

#6 @SergeyBiryukov
6 months ago

46575.diff is not enough, as running composer format on src/wp-admin/includes/export.php still results in the extra tabs. Since #44600, coding standards are enforced, and auto-fixable issues cause build failures in Travis.

Apparently this needs to be adjusted upstream in WPCS: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.

Last edited 6 months ago by SergeyBiryukov (previous) (diff)

#8 @SergeyBiryukov
6 months ago

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

In 45216:

Export: Remove extra whitespace from <title>, <content:encoded>, and <excerpt:encoded> elements in WXR files.

Props sgastard, juliarrr, aristath, SergeyBiryukov.
Fixes #46575.

#9 @ocean90
6 months ago

#47031 was marked as a duplicate.

#10 @ocean90
6 months ago

#47209 was marked as a duplicate.

Note: See TracTickets for help on using tickets.