This guide walks through the process of migrating a local WordPress site (https://mnrdsgn.com) to a live server (https://mnrdsgn.com) using WP-CLI and GitHub.

1. Preparing the Local Environment

Export the Local Database

Run the following command on your local machine to export the database:

wp db export local-db.sql
or
wp search-replace 'https://mnrdsgn.com' 'https://mnrdsgn.com' --export=live.sql

This will generate a local-db.sql file containing your local WordPress database.

Upload the Database to the Live Server

Transfer the exported database to your server using SCP:

scp -P 21098 local-db.sql mnrdjmke@198.54.125.196:/home/mnrdjmke/public_html/

2. Importing the Database on the Live Server

SSH Into Your Live Server

ssh -p 21098 mnrdjmke@198.54.125.196

Navigate to public_html and Import the Database

cd public_html
wp db import local-db.sql

If successful, you will see:

Success: Imported from 'local-db.sql'.

3. Updating URLs in the Database

Since the local database still contains references to https://mnrdsgn.com, you need to replace them with your live domain.

Update the Site URL and Home URL

wp option update siteurl "https://mnrdsgn.com"
wp option update home "https://mnrdsgn.com"

Perform a Full URL Search-Replace

wp search-replace 'https://mnrdsgn.com/' 'https://mnrdsgn.com' --skip-columns=guid

If serialized data needs fixing:

wp search-replace 'https:\/\/mnrdsgn2025\.local' 'https:\/\/mnrdsgn\.com' --precise --recurse-objects

Flush Cache

wp cache flush

4. Deploying the Theme from GitHub

Navigate to the WordPress Theme Directory

cd /home/mnrdjmke/public_html/wp-content/themes/

Clone the Theme from GitHub

git clone https://github.com/eboy79/your-theme.git

Activate the Theme

wp theme activate your-theme

Remove Unnecessary node_modules

rm -rf /home/mnrdjmke/public_html/wp-content/themes/your-theme/node_modules

Flush Cache Again

wp cache flush

5. Adding a Favicon

Upload favicon.ico to the Live Server

Run this from your local machine:

scp -P 21098 /Users/mnrdsgn/Local\ Sites/mnrdsgn2025/app/public/wp-content/themes/swagdrip/img/favicon.ico mnrdjmke@198.54.125.196:/home/mnrdjmke/public_html/wp-content/themes/your-theme/assets/

Reference the Favicon in header.php

Edit header.php:

nano /home/mnrdjmke/public_html/wp-content/themes/your-theme/header.php

Inside the <head> tag, add:

<link rel="icon" type="image/x-icon" href="<?php echo get_template_directory_uri(); ?>/assets/favicon.ico">

Save and exit (CTRL + X, then Y, then Enter).

Flush Cache & Refresh

wp cache flush

Then hard refresh your site (CTRL + SHIFT + R or CMD + SHIFT + R).

Verify the Favicon is Live

6. Adding a Clean Social Media Preview

Upload social-preview.jpg to the Live Server

Run this from your local machine:

scp -P 21098 /Users/mnrdsgn/Local\ Sites/mnrdsgn2025/app/public/wp-content/themes/swagdrip/img/social-preview.jpg mnrdjmke@198.54.125.196:/home/mnrdjmke/public_html/assets/

Update Open Graph & Twitter Meta Tags in header.php

Edit header.php:

nano /home/mnrdjmke/public_html/wp-content/themes/your-theme/header.php

Replace the existing Open Graph & Twitter tags with:

<!-- Open Graph Meta -->
<meta property="og:title" content="My Secret Formulas">
<meta property="og:description" content="">
<meta property="og:image" content="https://mnrdsgn.com/assets/social-preview.jpg">
<meta property="og:url" content="https://mnrdsgn.com">
<meta property="og:type" content="website">

<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="My Secret Formulas">
<meta name="twitter:description" content="">
<meta name="twitter:image" content="https://mnrdsgn.com/assets/social-preview.jpg">

Save and exit (CTRL + X, then Y, then Enter).

Flush Cache & Test

wp cache flush

7. Verifying the Deployment

  1. Visit https://mnrdsgn.com and confirm that the site is loading correctly.
  2. Access https://mnrdsgn.com/wp-admin and verify you can log in.
  3. Ensure all images, links, and pages work correctly.
  4. If any issues persist, run:wp search-replace 'https://mnrdsgn.com' 'https://mnrdsgn.com' --skip-columns=guid wp cache flush

๐ŸŽ‰ Deployment Complete!

Your WordPress site is now live at https://mnrdsgn.com. If any issues arise, check:

  • wp-config.php for incorrect URLs.
  • wp option get siteurl and wp option get home to verify settings.
  • Browser cache and DNS settings if changes don’t appear immediately.

๐Ÿš€ Enjoy your newly deployed WordPress site!

Additional Tips

  1. Trailing Slash: If your site references ended with a slash (https://mnrdsgn.com/ vs. https://mnrdsgn.com), ensure your search string includes or excludes the trailing slash as needed.
  2. Always Backup: Run wp db export backup.sql before making bulk changes.
  3. Dry Run: Add --dry-run to see what it would do without making changes:bashCopyEditwp search-replace 'https://mnrdsgn.com' 'https://mnrdsgn.com' --dry-run This shows the summary of proposed changes but wonโ€™t actually modify the DB.
  4. Flush Permalinks: After importing your updated .sql on live, go to Settings โ†’ Permalinks โ†’ Save or run:bashCopyEditwp rewrite flush to ensure everything routes correctly.

Conclusion: Your commands are correct for the two different patterns of URL storage. You may only need the second command if you have data stored with backslash escapes in your database. Otherwise, the first command plus a normal export (--export=live.sql) will handle the standard references.