Scheduling Imports Using Cron JobsEach time the cron is run, WP All Import will download your XML or CSV file from the specified URL and update, delete, and create posts on your site according to your settings.
To set up a recurring import using cron jobs, specify the URL to your XML or CSV file on the Import Settings page.
Then, visit the Scheduling Options link on the Manage Imports page to open the Scheduling Options Popup.
You will need to choose the 「Manual Scheduling」 option here:
Each import has two cron URLs – a trigger URL, and a processing URL.
The trigger URL will look something like this:http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=trigger
The processing URL will look something like this:http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=processing
You can find your secret key on the All Import -> Settings screen, and the import ID on the Manage Imports screen.
If you want to run your import every 24 hours, you should run the trigger URL every 24 hours. If you want to run your import once per week, you should run the trigger URL every week.
The processing URL should be run every two minutes because it may not finish your import in one run. The reason is that many hosts have maximum script execution times in place, so its only possible for the processing script to finish only a small percentage of your import before it is timed out.
If this is the case and the processing script is run again after two minutes, it checks to see if your import is finished, or if there』s still work to be done. If there』s work to be done, it will import posts for as long as it can, or two minutes, whichever is longer.
Then, on the next run of the processing script, it will see if more work needs to be done on the import – and if so, it will do it. If not, it will 「untrigger」 the import. And now the processing script will have no effect until the import is triggered again by the next run of the trigger script.
Setting Up Cron Jobs
The instructions for setting up cron jobs vary across hosts. Commonly, you can do it in your web hosting control panel.
To create a cron job that hits the cron URLs, commonly the wget command is used. Examples are on the Manage Imports -> Cron Scheduling screen of WP All Import.
Below are a few cron command examples (not all options work with all hosts, ask your host for help as needed):
wget --spider "http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=trigger&rand="$RANDOM
wget -q -O - "http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=trigger&rand="$RANDOM
curl "http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=trigger&rand="$RANDOM
lynx "http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=trigger&rand="$RANDOM
To ask your web hosting provider to set up the cron for you, use this e-mail template:
Hi Support,
Please set up two cron jobs.
CRON JOB 1Fetch this URL every 24 hours: http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=trigger
CRON JOB 2Fetch this URL every 2 minutes: http://YOUR-WEBSITE.com/wp-load.php?import_key=[YOUR_SECRET_KEY]&import_id=[YOUR_IMPORT_ID]&action=processing
Thanks,Your Name
If your web host doesn』t have a cron feature, you can use an external service like EasyCron.
Call Cron URLs from the Command Line
You can call the WP All Import and WP All Export cron URLs from the command line. This may be necessary if your site's configuration won't allow inbound calls to the regular cron URLs.
It'd look something like this:
/path/to/your/php-cgi /path/to/yourwordpressinstall/wp-load.php import_key=ABC123 import_id=5 action=trigger
/path/to/your/php-cgi /path/to/yourwordpressinstall/wp-load.php import_key=ABC123 import_id=5 action=processing
Note: The php-cgi binary must be used or the parameters won't be passed correctly.