WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#14847 closed enhancement (fixed)

Update featured image data in WXR import

Reported by: markel Owned by:
Milestone: WordPress.org Priority: normal
Severity: normal Version:
Component: Import Keywords: has-patch gci
Focuses: Cc:

Description

WordPress export files currently do not contain information on featured image selection.

Users moving a WordPress blog from one location to another have to manually re-select featured images for every post once the import is completed.

Attachments (2)

featured_image_import.diff (1.7 KB) - added by Nano8Blazex 7 years ago.
patch gci
featured_image_import.2.diff (1.3 KB) - added by Nano8Blazex 7 years ago.
revised

Download all attachments as: .zip

Change History (8)

#1 @duck_
7 years ago

  • Component changed from Export to Import
  • Milestone changed from Awaiting Review to WordPress.org site
  • Summary changed from Add featured image data to WXR export to Update featured image data in WXR import

The _thumbnail_id post meta is being exported, it's just that on importing this is not being updated to reflect the new ID of the attachment so it refuses to display. This should be relatively easy to fix since we already do things like replacing attachment URLs. Patch coming soon.

@Nano8Blazex
7 years ago

patch gci

#2 @Nano8Blazex
7 years ago

  • Keywords has-patch gci added

Also, something I noticed:

The importer replaces conflicting attachment URLs only once... meaning that on imports of new posts with an attachment that's already imported, the URL doesn't change and remains pointed to the original image on the original site.

My patch (my fourth one ever! so don't expect too much) has a similar problem -> If the post or page is reimported, and the image isn't reuploaded, the post's featured image data is overwritten and the problem resumes. I honestly don't know how to fix this.

This is hard to explain. It might not be a problem, considering that most people probably import another wordpress blog only once and don't try again.

#3 @duck_
7 years ago

Looking good (especially for your fourth patch!). Just a couple of things:

  • The new id_remap is actually unnecessary; look in process_posts for what you can use that's already there
  • I think it would be more efficient to make use of isset rather than the inner loop when updating the _thumbnail_id meta

From what you say about this other problem don't worry about it as it's beyond the scope of this task. I will do some testing and look into a fix.

#4 follow-up: @Nano8Blazex
7 years ago

Better? I'm having a hard time testing it, however hard I try I can't seem to get different ids when importing right now, so this revised patch isn't tested. :D

#5 in reply to: ↑ 4 @duck_
7 years ago

Replying to Nano8Blazex:

Better? I'm having a hard time testing it, however hard I try I can't seem to get different ids when importing right now, so this revised patch isn't tested. :D

First impression is that it looks good and will work nicely. Will do some testing and then close the task as completed.

Thanks :)

#6 @duck_
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.