Use Tasker to Trigger Your WordPress Crons


email


WordPress Crons do amazing things. From allowing you to schedule automatic full or database backups of your WordPress to having posts published in the future, Crons allow you to do almost anything you can think of.

WordPress Crons, however, do require some visit to any public page of your main site to trigger the cron to run. That could create problems for many people, specially Multisite owners where Crons are set to run on a Multisite level for all sub-sites, and yet where the main Multisite domain may not get any traffic.

Among the thousand other things Tasker can do via your Android phone, Tasker can also easily visit your website.

I’ve been using Tasker for a long time, and since last week started using Tasker to trigger Crons on Multisites which don’t get much or any traffic. And it works beautifully.

Since you can use Tasker to visit any website at any time automatically, once or regularly, you can use Tasker to trigger your WordPress Crons. Here’s how to do it.

Use Tasker to trigger WordPress crons or visit websites automatically on your phone

What is Tasker for Android?

Tasker for Android

Tasker for Android gives you wings!

Tasker is an Android app which allows you to do thousands of things based on almost any condition you can think of.

Want to notify yourself of an important task when you’re at the shopping mall? Tasker can detect your location and do that. Want to silence your ringer after 11pm? Tasker does that. Anything your phone is capable of doing, Tasker can allow you to control it and bend it in any manner you wish.

Social Improve will post some tutorials and info on Tasker on a regular basis.

Today, let’s focus on using Tasker for Android to visit any website automatically via your phone and also, if you wish, trigger crons on your Multisites.

Use a Tasker Android Profile to Visit Websites or Trigger WordPress Crons

Since all that’s needed for WordPress to run scheduled crons is a visit to any part of your main WordPress where the cron is scheduled, we’re going to create a Tasker profile to have your Android browser visit your site at any time of the day, stay on it for a few seconds, and then exit the browser.

You have 2 options to accomplish this: download and use the profile I’ve created for you to learn from that, OR create the profile from scratch and see how it’s done in detail.

Both options are outlined below.

Easy Option 1: Download the Profile

Here is my Tasker profile that you can download, save onto your phone or SD card, and then import into your Tasker.

Right click and save Tasker Profile to Trigger WordPress Crons – Trigger_WP_Crons.prf.xml

Remember to change any values you wish, specially the website link, to your own values after you’ve imported this profile into Tasker.

Long Option 2: Walk Through the Full Steps

Taking the long route? Awesome!

Here are all the steps, with associated screenshots, to help you create your own profile from scratch. Follow these simple steps and the associated pictures to setup a Tasker profile called “Trigger WP Crons”, which can be any other name you wish by the way. This is a one-time setup. Tasker will do everything automatically from then onward.

By default, all the “Ok” and “Accept” buttons in Tasker are green check boxes. All red cross marks mean “No”, “Cancel” and “OMG! WTH?”

If you’re unsure about any step, ask away in the comments below!

  1. Open Tasker and create a new profile by hitting the big green plus + button.

    The screenshot below shows all the active Profiles I have.

    Your screen will either be empty or will have differently named profiles, unless you and I think the exact same (or one of us is copying the other).

    Step 1 - Create a Tasker Profile

  2. Give your new profile any name and press the ok (green check mark) button.

    I usually pick names that will tell me instantly what they’re about, like “Trigger WP Crons.”

    Step 2 - Name your Tasker Profile Trigger WordPress Crons

  3. In the “First Context” step, you’ll choose the condition that will make Tasker start doing what you want it to do.

    For our case, we want Tasker to visit our website OR websites in question after the scheduled time of our Cron. If your scheduled cron OR plugin is set to run at, let’s say, 11pm, we can tell Tasker to run at 11:05pm or any time after 11pm.

    Because we’re dealing with time, choose the “Time” Context on this step.

    Step 3 - choose Time Context in Tasker

  4. Tasker will now show you some time options that you can use to run Tasker from any start time to any end time, and to run Tasker once or repeatedly at such times forever or as long as you wish.

    If your WordPress schedules are at 11pm, let’s tell Tasker to run this Tasker Profile at 11:05pm. Choose “23:05″ and “23:10″ on this screen.

    Also check the “Repeat” option, since we want Tasker to do this every night at 11:05pm from now on. Enabling the “Repeat” option will let you choose how often you want Tasker to run this task again and again. Choose “12 hours”, since we want Tasker to check if it’s 11:05pm, in order to trigger your WordPress Cron, every 12 hours. Don’t worry: even if Tasker checks at 11:05am (morning), it will not run your profile because of your specified “23:05″ and “23:10″ time frame.

    Press the ok button then.

    Step 4 - specify Times to run your Tasker Profile

  5. Next screen will allow you to choose a Task from a list of Tasks you may have already created OR allow you to create a new one. Tasks are what Tasker will actually do at the time you specified, like visiting your site.

    Choose “New Task” on this screen.

    Your actual screen will again look different since the names you see in my screens are what I’ve named my different Tasker elements for my needs.

    Step 5 - create a new Task for Tasker to perform

  6. You can (and should) name your tasks also, to make them easier to identify.

    I’ll name this task “Visit Site.” Name everything you can from the beginning in order to remember and identify things easily later on.

    Choose ok.

    Step 6 - name your New Task in Tasker

  7. Now you’ll see the “Task Edit/Visit Site” screen, or a similarly named screen depending on what name you chose for your tasks.

    This is where you’ll perform the final steps of your Tasker profile. This is where you tell Tasker what to do when it’s 11:05pm.

    Press the blue plus + button to create a new task.

    Step 7 - Tasker Task Edit/Visit Site screen

  8. You’ll now see a “Select Action Category” menu, which lists all the things you can do with your phone.

    It has a ton of options and several sub-options each, so don’t worry if it looks overwhelming. It’s usually a lot for me too, though I focus only on the names to get to where I want.

    In our case, choose “Net” on this screen.

    Step 8 - choose Net Action in Tasker to perform internet and network related actions

  9. You’ll now see several “Net” actions that Tasker can do for you.

    What we want is to browser your website, so choose “Browse URL” option.

    Step 9 - choose Browse URL to visit any web page

  10. This will load the “Browse URL” screen, where in the URL field you can type in your WordPress website URL where your WordPress crons are scheduled.

    This can be anything on your site, from the front page itself to any specific page.

    Tasker or your Android keyboard might capitalize the “H” in “http” portion of what you enter. No worries: ignore that and carry on, or simply edit the “H” into an “h” manually.

    I put in “http://socialimprove” here. You put your website link, that you want Tasker to visit, in this URL field. Hit ok.

    Step 10 - enter your WordPress site link where your scheduled Crons are

  11. Next we want Tasker to close the browser after, let’s say, 15 seconds of being on the site.

    At this step you should be back on the “Task Edit / Visit Site” screen, where you’ll see your Browse URL task from the previous step.

    Hit the blue plus + sign again to create another task.

    Step 11 - create a Wait Task after your Browse URL task

  12. On the “Select Action Category”, this time choose the “Task” action.

    Among other things, the “Task” action contains the commands to tell Tasker to wait as long as you wish before carrying on the next action.

    We want Tasker to wait 15 seconds before returning to the home screen. Hit the “Task” option.

    Step 12 - choose Task option to get Wait commands in Tasker

  13. Now you’ll choose “Wait” action under the “Task” action.

    Wait tells Tasker how long to wait before going to the next action.

    Step 13 - choose Wait Task to tell Tasker to wait for as long as you wish

  14. The “Wait” options menu has several ways to specify a time frame during which Tasker will pause the current profile from performing the next step.

    It may look complicated with so many time options, though it’s fairly easy to work with. We only want the “Seconds” option, so slide the “Seconds” tab using the plus button in front of it until it says “15″ seconds.

    Hit the ok green check mark button then.

    Step 14 - Set 15 seconds as Tasker Wait task

  15. You’ll now be returned to the “Task Edit / Visit Site” menu again, where you’ll see your “Browse URL” and “Wait” tasks.

    If everything looks good so far, hit the blue plus + button one last time so that we can tell Tasker to add the final task of visiting the Home screen to close the browser.

    Tip: in Android, you don’t have to exit applications. If you are on the home screen or turn off your screen display, Android automatically manages your memory and applications, turning off unneeded resources as needed.

    That is why we’re simply going to visit the Home screen to have the browser automatically close off when Android automatically realizes it’s not being used anymore.

    You don’t have to do anything in Android other than to visit the home screen to exit applications.

    Step 15 - All your Tasker Tasks so far

  16. On the “Select Action Category” screen, choose “App.”

    Step 16 - choose App task in Tasker

  17. You’ll see several “App” actions. Choose “Go Home” action.

    Step 17 - choose Go Home action to exit Android apps automatically

  18. You’ll now see the “Go Home” options.

    Ignore everything on this page, to keep your sanity like I do in the face of all the power Tasker offers.

    Hit the green ok check mark button.

    Step 18 - leave default options for Go Home action

  19. You’ll now be taken to your Task Edit / Visit Site screen, where you’ll see all your newly tasks.

    On this screen, if you wish, you can hit the bottom right “Play” button to test your settings. This will Start your browser, wait 15 seconds, and then go to the home page. You can open Tasker again after this to be returned to this exact screen.

    Hit the ok button again to finalize everything.

    Step 19 - Browse URL, Wait 15 Seconds and Go Home Tasks in Tasker

  20. You’re done now!

    On the resulting screen, where you’ll see all your profiles, scroll down to your newly created “Trigger WP Crons” profile, or whatever name you chose. Your actual screen will look different, since I’ve many other profiles there also.

    You’ll see a green check box in front of your newly created profile. This tells you that your new Tasker profile is active and will thus run as defined by you.

    If everything looks good, hit the bottom left green check box button. This button will be used by you always, as it tells Tasker to be active and to run in the background running all your active profiles.

    If you hit the red cross marks button here, Tasker will be paused, or disabled, until the next time you manually run Tasker and hit the green check mark button.

    Step 20 - your final Tasker Profile to trigger WP Crons

Awesome!

Your Android phone will now, every night at 11:05pm, load your website in your Android browser, stay on your website for 15 seconds, and then simply go back to the home screen.

This will make WordPress trigger any 11:00pm scheduled crons you have on that site.

Everything is automatic. You can keep sleeping through your scheduled cron triggers. Or you can keep playing Killing Floor and Battlefield: Bad Company 2 at this time, like I do.

What about non-Android users?

Tasker and the similar Locale apps are for Android only, so you’ll have find out similar apps for your phone. iPhone users shouldn’t have to worry though, since iPhone has been around longer and has a very strong developer base.

Google should help you find out an app similar to Tasker for your phone. Do similar Google searches for your other non-iPhone phones to find out something similar.

Post in the comments below if you can’t find something similar for your specific phone, OR if you find something other than Tasker that helps you do the same thing.

What do you think of using Tasker to trigger Scheduled WordPress Crons?

What do you think of this Tasker Profile? Can you use this to visit websites automatically at specified times? How do you deal with WordPress Crons for websites that do not get enough or any traffic?

Please share in the comments below. Thanks!









Leave a Reply