When many webmasters use WordPress to build a site, they will encounter the situation that the pictures in the article cannot be accessed or displayed after changing the domain name or moving; At this time, you need to batch replace the article images. This article summarizes the process of batch replacement of article images, hoping to help you.
Image link failure analysis
1. Changed the domain name of the site: Many webmasters chose the domain name at random in the early stage of building the site. They wanted to change a new domain name after operating for a period of time and getting results. At this time, after changing the domain name, they found that the picture in the article was still the previous link path. Once the previous domain name resolution was closed, the picture could not be displayed.
2. Map bed address or cloud storage is used: the resolution of the external domain name of the map bed or cloud storage fails or is replaced due to some reasons, which will make the original published article images cannot be displayed.
3. Other reasons The picture address is invalid In the above three cases, if you want to change the picture link address of an article, you do not modify it in batches. By manually modifying it, unless there are only ten or eight articles, it does not matter. Otherwise, it will be difficult to update the picture address.
Batch replacement using database commands
The following shows how to use the phpMyAdmin
Operation, other environments shall be subject to the actual situation.
1. It is preferred to enter the corresponding database and click the left side to select wp_posts
data sheet.
2. Then click on the right SQL
Select to execute the replacement command.
/** *Modify the old domain name and the new domain name according to your domain name */ UPDATE wp_posts SET post_content=REPLACE (post_content, 'old domain name', 'new domain name');
The execution is successful.
Other situations
The above method mainly solves the problem of article pictures not being displayed. In some cases, some pictures on other pages will not be displayed. You need to check other tables for replacement and modification, for example: wp_options
、 wp_postmeta
Etc.