0

I have been making a wordpress site on my LAMP installation locally, modifying theme and uploading posts and whatnot. So when it was time to finally upload it, I dumped the database, searched and replaced the pertinent strings of text to change domain, database, user, etc, uploaded all the files to my host, and restored the database from the file. But launching the site proper I saw that while all the posts and plugins and theme were migrated correctly, any changes I made with the wordpress integrated customizer were gone and set to the default values.

Does anyone have any idea of what might I be missing?

To prepare the files for upload I use this script

mysqldump -u ${DB_USER_OLD} -p${DB_PASS_OLD} -h ${DB_HOST_OLD} ${DATABASE_OLD} > ./localhost/mysqldump.sql
sudo rsync -aP --delete ./localhost/ ./Deploy/ --exclude .git

sed -i "s%define( 'DB_NAME', '${DATABASE_OLD}' );%define( 'DB_NAME', '${DATABASE}' );%g" ./Deploy/wp-config.php
sed -i "s%define( 'DB_USER', '${DB_USER_OLD}' );%define( 'DB_USER', '${DB_USER}' );%g" ./Deploy/wp-config.php
sed -i "s%define( 'DB_PASSWORD', '${DB_PASS_OLD}' );%define( 'DB_PASSWORD', '${DB_PASS}' );%g" ./Deploy/wp-config.php
sed -i "s%define( 'DB_HOST', '${DB_HOST_OLD}' );%define( 'DB_HOST', '${DB_HOST}' );%g" ./Deploy/wp-config.php

find ./Deploy/ -type f -exec \
    sed -i "s%http://${URL_OLD}%https://${URL_NEW}%g" {} \;
find ./Deploy/ -type f -exec \
    sed -i "s%${URL_OLD}%${URL_NEW}%g" {} \;

sed -i 's%utf8mb4_0900_ai_ci%utf8mb4_general_ci%g' ./Deploy/mysqldump.sql
sed -i "s%${DATABASE_OLD}%${DATABASE}%g" ./Deploy/mysqldump.sql

sudo chown -R ${HOST_UID}:${HOST_GID} ./Deploy/*

And then I do

rsync -azP --delete ./Deploy/ ${SSH-USER}:${PATH-TO-SITE}/
ssh ${SSH-USER} "mysql -u ${DB_USER} -p -h ${DB_HOST} ${DATABASE} < ${PATH-TO-SITE}/mysqldump.sql"
  • How are you doing the search replace? If you don’t do it properly you’ll break serialised values, which is what the options are stored as, as well as potentially many other things that will also be broken. – Jacob Peattie Apr 15 at 16:24
  • I do it with the sed lines in my script – metichi Apr 15 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.