-1

I exported blog posts to an xml file from a WordPress website and then imported them to another. I moved over all the images in their correct folders via FTP and then used a plugin to register them in the media gallery. They are in their correct months too. So, I have the blog posts, I have the images.

I even ran a search and replace in the database to change all the domain names to the new one yet when I go to edit the post, the featured image has a loading spinner that just spins forever and the image never shows up.

When I look in console I see this error:

Failed to load resource: the server responded with a status of 404 (Not Found)
https://example.com/wp-json/wp/v2/media/24168?context=edit&_locale=user

If I follow that link I see this:

{
"code": "rest_post_invalid_id",
"message": "Invalid post ID.",
"data": {
"status": 404
}
}

What is happening here and how can I fix it?

1 Answer 1

0

Did you check the "Download and import file attachments" option during export? Here's an answer talking about it.

If no then the data on images simply wasn't part of the export - but the posts that were exported still reference those image IDs from the old site (which don't exist on the new site).

If yes then what may have happened is the images were not downloaded from the old server during import. Though looking at the error this is less likely.

Also, FYI: WordPress keeps track of images in the same way as posts and pages: data on images are stored in the database in the same table with posts/pages. So a post's featured image field holds an ID of a WordPress post of type "image".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.