WP CLI and Cron with WP Synchro

WP CLI logo

WP Synchro supports WP CLI, which is the most widely used CLI (command line interface) to WordPress. This allows you to execute commands to a WordPress site, such as creating users, posts and much much more.

WP Synchro automatically adds a command to this tool, which allows you to run migrations directly from commandline, via SSH, via a Windows command prompt or planned via a cron system.

This is mostly used to plan the execution of migrations, so that it will run, lets say, every hour or whatever is needed. Alternatively it can be executed in another script, such as one being run as part of a CI (Continuous Integration) environment.

To get started, you need a working installation of WP CLI, which you can get from WP CLI website.

Then you execute this command in the site web root:

wp wpsynchro

Which will give you the commands supported by WP Synchro.

Currently we only support running migrations that are already configured on the frontend.

So to execute a migration, you first create it and then navigate to it on the Overview page and hover mouse over it, and press the "Schedule" link.

Schedule migration

This will bring up the popup, with the command you need to run. This could be something like:

wp wpsynchro run 5cebf0756c518

Which will run this specific migration from the command line and can be added to your hosting cron system.

Still using free version? - Upgrade to PRO with 14 day free trial

PRO version makes it possible for you to migrate files between your sites and to automatically make a database backup before migration.
You will get support for Basic Authentication and email notifications on success or failure. You also get access to priority support