Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SQL query to update URLs after moving a ClassicPress site.
UPDATE cp_options SET option_value = replace(option_value, 'OLD_URL', 'NEW_URL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE cp_posts SET guid = replace(guid, 'OLD_URL', 'NEW_URL');
UPDATE cp_posts SET post_content = replace(post_content, 'OLD_URL', 'NEW_URL');
UPDATE cp_postmeta SET meta_value = replace(meta_value,'OLD_URL', 'NEW_URL');
UPDATE cp_usermeta SET meta_value = replace(meta_value, 'OLD_URL', 'NEW_URL');
UPDATE cp_links SET link_url = replace(link_url, 'OLD_URL', 'NEW_URL');
UPDATE cp_comments SET comment_content = replace(comment_content , 'OLD_URL', 'NEW_URL');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.