Moving WordPress — Useful SQL Queries & References

Don’t feel like typing all that SQL? Try this handy SQL generator for moving WordPress.

The following is my personal collection of useful SQL queries & references for moving WordPress.

WordPress Address (URL) & Site Address (URL)

Use the following SQL query to change the Site URL and Home URL in the wp_options table.

UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';


Use at your own risk! Please read this before executing the following query.

UPDATE wp_posts SET guid = replace(guid, '','');


This query will fix all the internal links in the wp_posts table.

UPDATE wp_posts SET post_content = replace(post_content, '', '');


These articles in the WordPress Codex are also quite useful:

Leave a Reply

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

Are you in need of a freelance web developer?

Hire me