0

I have just move my website from a server to a cpanel which become localhost now. I simple copy all the wordpress file and database to cpanel.In fact, all the product image is can not be linked to the current media library, they linked to my previous website media library.I have tried to correct the URL in wp_post_content and wp_options but it won't help any more. Is there any advice for me to link the product image back to current media library?

0

Image files are referenced in the post database with the full url to the image file. (Media is just another type of post.)

So, if you move your site, you need to adjust the URLs in the database to the new URL. That is most easily done with a Search and Replace plugin (I like "Better Search and Replace"). That will allow you to search for the old URL (domain, usually) and replace it with the new URL.

That plugin has a 'test' mode to see what it will find. And, of course, database backup first is always a good idea.

|improve this answer|||||
  • I have tried to use the plugin before, but it seems doesn't work for me – kin Sep 8 '19 at 21:49
  • If the plugin doesn't work for you, then contact the plugin support area. I've never had a problem with it. I always do a test first. In your case, search for 'www.oldurl.com' and replace with 'www.newurl.com'. Should find the URLs to your media. And look at a media item to see if's URL. That will tell you what to search for, if needed. – Rick Hellewell Sep 9 '19 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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