How to display images in wordpress after changing a new domain

“WordPress Address (URL)” and “Site Address (URL)” in the WordPress website management background settings automatically fill in the default URL of the corresponding website.


Sometimes, the webmaster may encounter the situation of changing the domain name, but when using the new domain name to access, the previously uploaded pictures cannot be displayed.

In fact, don’t worry, here is a simple method, after correcting the picture address to the corresponding address of the new domain name, it can be displayed.

1. Change “WordPress Address (URL)” and “Site Address (URL)”

You can use phpmyadmin to connect to the website database and update the wp_options table with fields: option_name values: siteurl and home, and the corresponding option_value values are the new domain name.

Only after completing this step can you successfully enter the background, otherwise even if you enter the password, it will automatically jump to the original old domain name.

Of course, you can also use a SQL execution statement to complete the above two domain name change settings. Open the data table wp-options, switch to the SQL state, and enter the following code in the input field to execute:

UPDATE wp_options SET option_value = replace( option_value, 'Old domain name', 'New domain name');

2.After changing the new domain name, the picture cannot be displayed in the article

Enter the phpmyadmin database management, find the wp_posts data table, switch to SQL state, enter the following code in the input field to execute:

UPDATE wp_posts SET post_content = replace( post_content, 'Old domain name', 'New domain name');

After the above database operation, the old domain name can be changed to the new domain name, and the website can be accessed normally.

Add a Comment

Your email address will not be published. Required fields are marked *