Here we will list many content migration methods as we discover them and refine this process.
Method 1 (WordPress to WordPress)
This method is for migrating a wordpress website's posts and pages with their attachments. In this case we have access to the old website via FTP as well as an admin user for the WordPress site.
Our Goal is to move the posts, pages, and media files from the old website into a new website that is using our FMBuildr theme.
1. Install a vanilla FMbuildr5 on the hosting environment.
2. login to old website via FTP or SSH and download a complete copy of it's /wp-content/uploads/ directory. Preferably, zip this folder before moving it around. This will save a ton of time.
3. upload the old websites /uploads/ directory to your new WordPress site at /wp-content/uploads2/
4. Use rsync to merge the old contents of /uploads2/ and /uploads Note: make sure that your command has the trailing / at the end of each folder or this will not work correctly
rsync -a /uploads2/ /uploads/
5. now that we have our files merged over, lets export the posts and pages from the old WordPress site with the default exporter. Note: in the wp admin, Go to tools > export, export posts, then export the pages.
6. login to the new website, then import the posts with the .xml file dowloaded from the old website. Note: make sure that the media files are not downloaded to the new site, uncheck the box in the options at the bottom of the screen when importing your posts.
7. Import the pages next, use the .xml file downloaded from the old website. Note: Please do not include media attachments on this import either.
8. Now all posts, pages and media are on the new website but we need to update the db to reflect the new urls. Run a search-replace with wp cli on the new website.
wp search-replace 'https://old-url.com' 'https://new-url.com';
wp search-replace 'old-url.com' 'new-url.com';
Tip: use the --dry-run flag/option to test this before running the actual search-replace
9. Now we need to connect the database to the media files that we uploaded earlier in FTP. We will use a plugin to do this:
https://wordpress.org/plugins/bulk-media-register/
10. Review a few posts, and pages with inspector in your browser to ensure that the content is there, the media is linked to the correct url
11. review the media library on your new WordPress site, to ensure that your media files are all showing up.
12. Now we can clean up any unused media files. To do this we will install: https://wordpress.org/plugins/media-cleaner/
13. If all went well, create a new git commit point and push it to your repo on bitbucket.