import-command icon indicating copy to clipboard operation
import-command copied to clipboard

Missing the featured image remapping process after import

Open GonZOO82 opened this issue 5 years ago • 5 comments

I tried the CLI tool, and I import the big XML file. Importing is fast and cool, but I have a big problem. When I import the post with attachment (featured image) then is not paired to the post. I don't add the post_id to the post, but I use incrementing ID at attachment and that I add to the meta_value to the post item.

Sample XML:

<item>
    <title>Post content title</title>
    <wp:post_type>post</wp:post_type>
    <wp:postmeta>
        <wp:meta_key>_thumbnail_id</wp:meta_key>
        <wp:meta_value><![CDATA[1234]]></wp:meta_value>
    </wp:postmeta>
</item>

<item>
    <wp:post_id>1234</wp:post_id>
    <title>demo.jpg</title>
    <wp:post_type>attachment</wp:post_type>
</item>

GonZOO82 avatar Jul 22 '19 20:07 GonZOO82

I suspect this is due to the known bug in here: https://github.com/wp-cli/export-command/issues/53

I'll try to see if we can fix this bug for the upcoming v2.3.0 release.

schlessera avatar Jul 23 '19 16:07 schlessera

I'm still seeing this bug. Is there any ETA on resolving it?

curtismchale avatar Jun 23 '20 15:06 curtismchale

+1

I just used wp import and that generally works fine but without automatically mapping the images / attachments to the posts the whole process is being rendered useless IMHO...

E-VANCE avatar Oct 19 '20 09:10 E-VANCE

+1 ... will this ever be fixed?

dzg avatar Sep 04 '21 09:09 dzg

I've just setup a new site, filled it with a 100 demo posts. Then setup a second site with 2 posts, 3 images and where 1 post had a featured image. I exported the 2nd site and imported it into the first demo site. The featured image is correctly set.

It appears this is done in the wordpress-importer plugin that the import command uses. The exact line that fixes it even is commented // if the post has a featured image, take note of this in case of remap

So I would vote to close this issue.

janw-me avatar Oct 08 '21 10:10 janw-me