Skip to content

Instantly share code, notes, and snippets.

@matiasmasca
Created March 31, 2015 14:48
Show Gist options
  • Save matiasmasca/16e11d47e2811d7a765e to your computer and use it in GitHub Desktop.
Save matiasmasca/16e11d47e2811d7a765e to your computer and use it in GitHub Desktop.
Migrar sitio WordPress. De Desarrollo a Producción
-- Consulta para migrar la base de datos de WordPress de desarrollo a producción. Gracias Sergio A. Moreyra.
UPDATE wp_options
SET option_value = replace(option_value,'http://www.TuSitio.com/desarrollo', 'http://www.TuSitio.com')
WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts
SET guid = REPLACE (guid, 'http://www.TuSitio.com/desarrollo', 'http://www.TuSitio.com/');
UPDATE wp_posts
SET post_content = REPLACE (post_content, 'http://www.TuSitio.com/desarrollo', 'http://www.TuSitio.com');
UPDATE wp_posts
SET post_content = REPLACE (post_content, 'src=" http://www.TuSitio.com/desarrollo/', 'src=" http://www.TuSitio.com/');
UPDATE wp_posts
SET guid = REPLACE (guid, 'http://www.TuSitio.com/desarrollo', 'http://www.TuSitio.com')
WHERE post_type = 'attachment';
UPDATE wp_postmeta
SET meta_value = REPLACE (meta_value, 'http://www.TuSitio.com/desarrollo','http://www.TuSitio.com');
@matiasmasca
Copy link
Author

Fijate el PRE fijo de las tablas, que sea el que usa tu configuración de WordPress

@matiasmasca
Copy link
Author

Más información sobre como mover una instalación de WordPress
http://codex.wordpress.org/Moving_WordPress

@matiasmasca
Copy link
Author

Revisar todas estas tablas:

wp_options > siteurl
wp_options >home
wp_site
wp_sitemeta > siteurl
wp_blogs > domain (change this for all instances that use your old domain)
wp_#_options > siteurl (the “#” refers to the blog ID of additional sites in your network)
wp_#_options > home
wp_#_options > fileupload_url

@anibalardid
Copy link

anibalardid commented Nov 14, 2018

OJO... hay plugins q tb guardan la url del dominio, por ejemplo los site builders o themes premium

Yo por bash genero un .sql del dump de la base y con SED lo reemplazo:
sed -i -e "s/${source_domain//\//\\/}/${target_domain//\//\\/}/g" $dump_db.sql

@anibalardid
Copy link

esas barras dentro de las llaves son para "escapar" si hay / (slash)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment