When you are running a blog for years, you will come across the need to migrate your entire site. It could be due to the change in hosting company or migrating from one theme to another. However, there could be a situation you want to migrate specific posts to another installation. In this article, we will explain how to migrate specific posts from one WordPress site to another.
What Scenarios You Need to Migrate Specific Posts?
We have almost 2000 posts on our site with different kinds of content. Therefore, we have decided to move all review posts scattered across the site to a separate subdomain. Now that the case is clear, but we don’t have a straightforward solution in WordPress to do that. However, you also don’t any plugins for that.
There could be also other reasons like moving to subdirectory, splitting and merging the sites.
How to Migrate Specific Posts from One WordPress Site to Another?
Follow the below instruction to migrate specific posts:
- Group the posts on your old site
- Export the grouped posts to XML
- Prepare your new site
- Install the importer
- Import the XML from old site
- Correct the URLs
- Setup redirection in old site
Let us explain each step in details.
Learn WordPress: Check out 400+ free WordPress tutorials.
1. Group Posts on Old Site
The first step is to group all the posts you want to migrate on your old site. You should have all the posts under one of the below groups:
- Posts are in a same and unique category so that you can migrate them without touching other posts on your site.
- Have a unique author for all the posts you want to migrate.
- Check whether all posts you want to migrate are within a date range without mixing with other posts.
- Assign all posts you want to migrate to a same status not mixing with other posts.
If your posts belong to one of the above criteria then the task is easy for you. However, in our case, the posts are scattered across the site under different categories published during different time period. Therefore, it does not fall under any of the above situation. We have decided to change the status and migrate them all.
- Go to “Posts > All Posts” in your dashboard and select the posts you want to migrate.
- Click on the “Bulk Edit” dropdown and select “Edit” option.
- Click “Apply” button to edit all the selected posts in once.
- Remember, by default WordPress will show 20 posts per page. If you want to select many posts, you can click on the “Screen Options” on the top right corner. Change the number of posts per page to 100 to get all the posts in a single page. If you have to select beyond hundred posts, we recommend you to do repeat the below steps multiple times to change the status.
- When you are in bulk edit screen, change the status from “Published” to “Pending” and click on the “Update” button. Ensure, you don’t have any other posts in “Pending” status, or you can change to other status like “Draft” or “Private”.
Now that you have all the posts under the same status to go to next step.
2. Export Grouped Posts to XML
You have to export the grouped posts in an XML feed using the built-in import / export tool in WordPress.
- Go to “Tools > Export” section.
- You can see the option to export all the content on your site or specific post types.
- Choose “Posts” to see further options to choose the posts for migration.
- Click on the status dropdown and choose the status you have assigned to your posts.
- Click on “Export” button to download the XML file of the export.
3. Prepare Your New Site
Install WordPress on your new site and clean it up for the migration. The importing process depends on multiple factors.
- If you have a plugin specific posts (like reviews in our case), it is better to have the same plugin settings for the migrated posts to work in similar old fashion.
- Generally, migration does not depend on your theme.
- Ensure you have no category, author and comment users with the same name as in the posts to be migrated.
- It is good to have a plain installation to make the process simple. If you have any existing content under same category change them to a temporary category. You can assign the posts back to required category after migration.
You can install a coming soon plugin and discourage the site from search engine indexing till the time it is ready for public launch.
4. Install Importer on New Site
- Go to “Tools > Import” section to find all tools related to migration.
- Scroll down the page and find the “WordPress” option which should be the last option.
- Click on the “Install Now” link to install the WordPress importer. WordPress will install the built-in installer on the screen in few seconds.
5. Import XML from Old Site
- After installation, click on the “Run Importer”.
- Select the exported XML file from your old site and click on the “Upload file and import” button.
- WordPress will ask you to confirm whether you want to create the author of the posts or you want to assign the posts to one of the existing authors on your new site. Select the author for the migration as per your need. Alternatively, you can also migrate all posts with “admin” as author.
- If you have few images then click on the “Download and import file attachments” checkbox. In case if the posts have many images, we recommend to uncheck this box. Otherwise, it may take long time for the import to complete and in most cases it may fail due to time our error.
- Click “Submit” button to import the content. After successful import, WordPress will show you a message “All done. Have fun!”.
- The imported users will have “Subscriber” role by default. You should go to “Users” section and assign the appropriate role as author or another relevant role.
6. Correct URLs and Publish New Site
When you migrate all the links like external hyperlinks and image URLs will still point to your old site. You have to update the URLs to the new site URL. The easy way is to search and update the MySQL database to replace old URL with new URL. However, you can also use plugins or manually update the content by editing the posts.
After everything is ready, you can disable the coming soon mode and enable the search engine indexing to make the site public.
7. Setup Redirection in Old Site
The last step is to delete all your migrated posts on the old site and setup a redirection to your site’s URL. You can make use of the plugins like “Redirection” to setup a 301 redirect. Alternatively, plugins like Yoast SEO premium version will help you to automatically setup 301 redirect when you delete the posts.
You can group the posts and migrate out of your current WordPress installation any point when you need. Though the process is lengthier, it works seamlessly. We hope the above steps work fine for you and help you to migrate the posts to a new WordPress site.