Tips / Recommendations

SQL queries to transfer a WordPress site to another domain

Describing SQL Queries

In general, there are three main requests (there is a fourth request in the screenshot, but about it a little later). So, https://test.onmywaystudio.net/ is the old domain, https://onmywaystudio.net/ is the new one.

WordPress database table names are prefixed. By default, this is wp_, but on your site the prefix can be absolutely anything, for example, your wp_posts table may be called omw_posts or qwertyposts, keep that in mind.

 

UPDATE wp_options SET option_value = REPLACE (option_value, ‘https://test.onmywaystudio.net/’, ‘https://onmywaystudio.net/’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET post_content = REPLACE (post_content, ‘https://test.onmywaystudio.net/’, ‘https://onmywaystudio.net/’);
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, ‘https://test.onmywaystudio.net/’,’https://onmywaystudio.net/’);

Leave a Reply

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

3 + eight =