WordPress is popular not only because bigger websites use the platform. It has many useful features built-in with the installation package. One such useful feature is to export and import the site content. In this article, let us explain how to export and import a WordPress site to migrate entire content to new installation.
Related: How to migrate Weebly to WordPress?
Export and Import a WordPress Site
Recently, we ran into a problem on one of our WordPress installations. We wanted to export the entire content on the WordPress site and move to a fresh installation. Below are the steps you need to follow for exporting and importing an entire WordPress site.
- Export the required content from old site
- Prepare your new site
- Import the content on new site
1. Exporting WordPress Site
Login to your WordPress dashboard and navigate to “Tools > Export” section. Here you can generate a XML file that contains data of your site. You have multiple options to export the content.
- All the content – choose this option to export posts, pages, comments, custom post types, custom fields, categories and tags. This is the option for exporting entire content on your site. There are no further selections required when you choose this option.
- Posts – if you only want to export posts then choose this option. You have further options to select categories, authors, date range and status of the posts like published, pending or in draft.
- Pages – select this option if you want to import only pages. You will see further options similar to posts, except the categories.
- Media – choose this to export the media attachment content. You will have further option to select the month.
Remember, none of these options will export the actual images like PNG or JPEG from your site. You need to manually download all the images and media files through FTP and upload them on the new installation under “/wp-content/media/” folder. Alternatively, you can download and import during importing the content. However, this may take lot of server resources depending upon the number of images and media files. So, we recommend to manually uploading through FTP if you have lot of image files.
In our case, we wanted to export only posts as we have few images. After selecting the posts option click on the “Download Export File” button. This will generate a XML feed and save under the default “Downloads” folder on your computer.
2. Preparing New Installation
Once, you have exported the old site’s content, next step is to prepare the installation of your new site. There are two possibilities here – one is to delete the current site and install on the same domain, subdomain or subdirectory. Other is to install WordPress and import content on a new domain.
Installing on Same Domain
If you want to install on the same domain, subdomain or subdirectory then first take a back of your database and site files. Learn more on how to backup your WordPress site. Delete the entire installation and cleanup the files and database. If you have installed through one-click apps like Softaculous then you can destroy the entire installation in single click. Otherwise, you need to manually delete WordPress files using FTP.
Remember, deleting old site is irreversible action. We recommend you to keep the old site and do a fresh install on a subdomain or subdirectory. Later, you can easily change the URL of the site similar to your old site.
Installing on Different Domain
If you want to install the content on new domain then you can keep the old site by setting up maintenance mode and discouraging site engines. This is required to avoid Google tries to index the same content on two different domains.
You can either manually install a new WordPress site on a new domain or use one-click installation options from your cPanel. Ensure that your new site has similar structure like the old site. For example, check the permalinks and media URLs are similar like your old site. Also, install all the plugins you have installed on the old site.
3. Importing XML File
Navigate to “Tools > Import” section on your new site’s dashboard. You will see a list of installer options for importing content from different sources.
- Scroll down and find the last “WordPress” option.
- Click on the “Install Now” button to install WordPress import installer.
- After installing, click on the “Run Importer” button.
- Choose the XML RSS file downloaded from your old site. Remember, WordPress will show the maximum file size limit; in our case it is 128MB. If your XML file size is more than the maximum upload file limit, you should increase the upload limit by changing the PHP setup on your server side.
- Click “Upload file and import” button.
WordPress will prompt you to choose the author for mapping the posts.
- If you have a single author, then first create the same author on your new site before importing. You can choose the author name from the “assign posts to an existing user” dropdown when importing.
- If you have multiple authors then create authors during import. WordPress by default will assign “Subscriber” roles to the new users. You need to manually change the user roles to author again. Also WordPress assigns randomly generated passwords to new users. You may need to change and reset the passwords if required.
As mentioned before, you can choose the checkbox “Download and import file attachments” to import the images from old site. Do this only if you have fewer images on the old site. Otherwise, the import will never complete when you have hundreds of thousands of images for importing. The safer option is to download and upload the images with same directory structure.
Finally click on “Submit” button. If everything goes fine, you will see a success message “All done. Have fun!”.
Points to Remember in Importing
- WordPress will also remind you to update the password and roles of the newly created users.
- You can go to “Posts” and verify all posts are imported successfully.
- The exporting and importing will work for all the content including the posts in trash. After importing, you will find the posts in “Trash” if you have exported with trashed content.
- If you have media and pages in the exported XML file then WordPress will show the status of those files after importing.