Created
April 15, 2013 08:22
-
-
Save robinnorth/5386677 to your computer and use it in GitHub Desktop.
WordPress: Prepare database for production environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update options | |
UPDATE wp_options SET option_value = REPLACE( option_value, 'staging.com', 'production.com' ); | |
# UPDATE wp_options SET option_value = REPLACE( option_value, '[email protected]', '[email protected]' ); | |
# Update inline images | |
UPDATE wp_posts SET post_content = REPLACE( post_content, 'staging.com', 'production.com' ); | |
# Update image attachment GUID | |
UPDATE wp_posts SET guid = REPLACE( guid, 'staging.com', 'production.com' ) WHERE post_type = 'attachment'; | |
# Update custom fields | |
UPDATE wp_postmeta SET meta_value = REPLACE( meta_value, 'staging.com', 'production.com' ); | |
# Update post GUID | |
UPDATE wp_posts SET guid = REPLACE( guid, 'staging.com', 'production.com' ); | |
# Change post author | |
# UPDATE wp_posts SET post_author = 'new-author-id' WHERE post_author = 'old-author-id'; | |
# Update Multisite | |
# UPDATE wp_site SET domain = REPLACE( domain, 'staging.com', 'production.com' ); | |
# UPDATE wp_sitemeta SET meta_value = REPLACE( meta_value, 'staging.com', 'production.com' ); | |
# UPDATE wp_blogs SET domain = REPLACE( domain, 'staging.com', 'production.com' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment