Changing paths to images in Wordpress

扶醉桌前 提交于 2019-12-11 06:26:34

问题


I recently moved a friends blog onto his new web hosts but unfortunately the images are not working.

This is due to the old host having the following path for images:

http://www.example.com/blog/wp-content/uploads/2009/07/imagename.jpg

The new host uses a different layout and has this path for the file:

http://www.example.com/wp-content/uploads/2009/07/imagename.jpg

'Blog' has been removed.

Does anyone know the easiest way to fix this issue?


回答1:


I've found this tutorial on Exporting and Importing Wordpress very helpful in such situations.




回答2:


Use this query on your database:

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com/blog','http://www.new-domain.com');



回答3:


Search RegEx is a good plugin to be able to search and replace with Grep through all posts and pages. Also look in template files for hardcoded links in the form of <>php bloginfo(); ?> for the unneeded /blog/ in the path.




回答4:


Search replace is a good plugin as well as Search RegEx. Especially if your data to replace is widespread throughout your site. http://wordpress.org/extend/plugins/search-and-replace/



来源:https://stackoverflow.com/questions/2468141/changing-paths-to-images-in-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!