How to change WordPress website URL and image Path?

Do you know how to change WordPress URL? For example, if you want to move WordPress to a new server or a new domain, what do you do now?

In today’s post, I will tell you some WordPress skills. By simply executing a SQL query against your WordPress database, you can make the important changes easily and efficiently. Enjoy!

Shown below are some SQL queries that can be of great assistance to you when using WordPress.

1.Change WordPress Blog Siteurl and Homeurl

UPDATE wp_options SET option_value =
REPLACE(option_value, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com')
WHERE option_name = 'home' OR option_name = 'siteurl';

2.Change WordPress URL in Content

UPDATE wp_posts SET post_content = REPLACE
(post_content, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com');

3.Change WordPress Image Path

UPDATE wp_posts SET post_content = REPLACE
(post_content, 'src="http://www.oldsiteurl.com', 'src="http://yourcdn.newsiteurl.com');

4.Change Default “Admin” Username

UPDATE wp_users SET user_login = 'Your New Username' WHERE user_login = 'Admin';

5.Change WordPress Password – if you forget WordPress Password

UPDATE wp_users SET user_pass =
MD5( 'new_password' ) WHERE user_login = 'your-username';

If you want to move your WordPress blog across domains or forget password, the above SQL queries can be useful and help speed things up for you.

Good luck!

Related Posts

How to check wordpress theme for malicious code