WordPress.org

Make WordPress Core

Opened 12 months ago

#39021 new enhancement

Import Export Attachments

Reported by: LewisCowles Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: General Keywords:
Focuses: administration Cc:

Description

Currently when we export a post type, it seems that the post thumbnails are exported as id's. It would be fantastic if these could be exported as url's to the images as otherwise there is no way for a separate install to import the post data.

currently, for posts with a thumbnail the below or similar is added to the <item>

		<wp:postmeta>
			<wp:meta_key><![CDATA[_thumbnail_id]]></wp:meta_key>
			<wp:meta_value><![CDATA[9]]></wp:meta_value>
		</wp:postmeta>

I propose this is moved to <wp:attachment> or <wp:post_thumbnail> and the specific postmeta for _thumbnail_id removed from postmeta and re-created on each import.

Problems with my suggestion that I've considered

  • Re-importing (w|c)ould create duplicate media. As the post has to exist for post-meta to be added. Maybe using the basename function we could check for existing media, maybe it's an edge case... I think this is unlikely to be a large problem and it potentially empowers less technical users.
  • Some plugins would see no benefit as they use either custom metadata keys or multiple attached images (like WooCommerce). I'd suggest this could be mitigated by adding a filter of an array of strings that on import / export treats a list of fields as keys to treat as thumbnails)

Change History (0)

Note: See TracTickets for help on using tickets.