Skip to content

A neat little app to move a Wordpress installation one post at a time..

License

Notifications You must be signed in to change notification settings

robrab2000/WP-REST-Migrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wordpress REST Migrator (WRM)

WRM is a free and open source (GPLv3) tool for Wordpress which helps you to export or migrate your Wordpress site using the Wordpress REST API.

The tool was developed out of my frustration with trying to migrate really big wordpress sites (>5gb) and finding that it was tricky to do using migration plugins. Of course one could always just perform a manual migration copying the database and the files but this can be tricky too (phpmyadmin can struggle with large imports).

This project takes a slightly different approach to migration. Instead of packaging up the whole site and migrating it all (the entire database and all the files), it migrates just the content of the wordpress site. Essentially, it uses the Wordpress REST api (thanks to derwentx for the excellent python wrapper) to go through each post on the site, extracting the content/metadata and then uploading them to a second wordpress site one by one.

Not only does this approach work quite well for sites that are too big for traditional migration, but it does a good job cleaning your site of bloat. (Its a bit like dialysis..) A Wordpress database can get clogged up with old crap (mostly from installing and uninstalling plugins/themes), by migrating just the content that you actually NEED to a fresh Wordpress installation, you are left with a clean database and file system. (of course you will need to still set up everything else like themes and plugins again on the new site)

The package goes through the contents of each post and looks for media content (images), downloading each image and uploading it into the new site so that it gets indexed correctly.

I built this for my own use but I'm happy to keep working on it if people find it useful.. Let me know :)

tl;dr

  • Use the Wordpress REST api to migrate from one Wordpress installation to another.
  • This package is also great for cleaning up your bloated wordpress.
  • It extracts the content (posts, pages, comments, tags, media, etc.) and re-inserts it all one by one, replacing tags and media etc as needed so that they all have the correct ids.

* Remember to disable reCapcha from your sites before attempting the migration

To Do:

  • Export posts (including media contained)
  • Export tags
  • Export categories
  • Export featured media
  • Export pages (including media contained)
  • Export menus
  • Make wordpress plugin for automating application setup
  • Allow post/page exclusions
  • Command Line setup instructions

Requirements

  • Python 3
  • Two Wordpress installations with ftp/ssh access
  • python libraries:
    • requests
    • requests_oauthlib
    • six
    • argparse
    • BeautifulSoup4
    • wordpress-api (a newer version can be found on their GitHub page)

Instructions for Use

  • Clone the repository onto your local machine: git clone https://github.com/robrab2000/WP-REST-Migrator.git

  • Next you should have two wordpress site set up. One as a host that you will migrate from, the other is the receiver which will be migrated to. (in the config file they will be referred to as WP1 and WP2)

  • On Each Wordpress installation you will need the following plugins installed:

  • Check that you have the correct ownership and permissions set for the directory that of the Wordpress installation you are migrating to

  • Disable capcha-on-login plugins as they could stop the api from accessing your sites

  • Create a file called success.html and put a copy in both wp folders (this file can be empty)

  • In each Wordpress installation, set up an "Application" (found under "Users" menu in the backend). They will ask for some details so I have included some you can use below, in the Application Template section)

  • Each Application will give you a set of credentials (key and secret), copy and paste these into the default config file (or you can make your own config file which is prolly a better idea anyway)

  • Run the python script

Application Template

Title: WP-REST Migrator

Description: Wordpress REST Migrator (WRM) Application. WRM is a free and open source tool for Wordpress which helps you to export or migrate your Wordpress site using the Wordpress REST API.

Callback URL: https://your-site.com/success.html

Troubleshooting Notes

  • Some hosting providers (basically most shared hosting environments) block ports for security reasons. This might throw a spanner in the works. In this case you will probably just need to speak with them and get them to allow the wordpress api through their firewall.
  • I've noticed that sometimes your security plugins could get in the way. For example a Capcha on login will probably prevent it from authenticating. I think Wordfence should be alright but I just disabled it for good measure (of course its probably a good idea to re-enable it as soon as possible once you're done).
  • This is the first application I've made so if there is anything (specifically in the documentation) that you feel could be better, please don't hesitate to get in touch ;)

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

About

A neat little app to move a Wordpress installation one post at a time..

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published