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?
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?
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.
Use the Better Search And replace Plugin and replace you old site Url with new one.
For Example: old site URL : https://stagingdev.com and New Site URL : https://demolive.com enter the url on this plugin setting page and it will be replace on your DB all table that will help in your case.