admin管理员组

文章数量:1313120

I recently inherited a large site from a developer that vanished. The site has more than 6,000 images. In the pages most of the images are missing, however, they are referenced in the media library and I can see them on the server under wp-content/uploads. When I try to access any of these images with the blank thumbnail I get the following error message:

Missing Attachment

Given that this site has been moved to a new host I am pretty sure that these images are not properly referenced but I am not sure how to modify the path to the images to get them to show up properly. I did some research and tried the following:

UPDATE wp_posts set post_content=REPLACE(post_content, 'mysitexyz.basepointsite/', 'mysitexyz/');

What is the correct way to re-associate these images and have them appear correctly in the media library?

I recently inherited a large site from a developer that vanished. The site has more than 6,000 images. In the pages most of the images are missing, however, they are referenced in the media library and I can see them on the server under wp-content/uploads. When I try to access any of these images with the blank thumbnail I get the following error message:

Missing Attachment

Given that this site has been moved to a new host I am pretty sure that these images are not properly referenced but I am not sure how to modify the path to the images to get them to show up properly. I did some research and tried the following:

UPDATE wp_posts set post_content=REPLACE(post_content, 'mysitexyz.basepointsite/', 'mysitexyz/');

What is the correct way to re-associate these images and have them appear correctly in the media library?

Share Improve this question asked Sep 18, 2014 at 19:44 forrestforrest 4833 gold badges7 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 7

There's a few plugins to fix this, but basically it your database still references the images to be "oldsite/wp-content/uploads/" and you need it to be "newsite/wp-content/uploads"

So you have to change all old references. You could use SQL:

    UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldsite’, ‘http://www.newsite’) WHERE option_name = ‘home’ OR option_name = ‘siteurl';
    UPDATE wp_posts SET guid = replace(guid, ‘http://www.oldsite’,’http://www.newsite’);
    UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.oldsite’, ‘http://www.newsite’);
    UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘http://www.oldsite’, ‘http://www.newsite’);

I used to use this plugin which worked great for transferring sites.

https://wordpress/plugins/velvet-blues-update-urls/

And this plugin is specifically for letting you sync local and remote changes that have been made throuh ftp:

https://wordpress/plugins/ftp-sync/

Or here's a few other popular ones, they pretty much do the same thing:

MPress Fix URL References https://wordpress/plugins/mpress-fix-url-references/

Go Live Update URLS https://wordpress/plugins/go-live-update-urls/screenshots/

本文标签: pathsHow do I 39rebuild39 the WordPress Media library after transfer to new host