Ashley Cameron Design

Ashley Cameron Design

Shop the Creative Design Market

Good evening

How to Add a Cron Job in WordPress Using WP Crontrol Plugin (example using BackWPUp) with ALTERNATE_WP_CRON

WordPressWordPress

About a 1 minute read

"It is the supreme art of the teacher to awaken joy in creative expression and knowledge."

Albert Einstein

For a website, we have to use define( ‘ALTERNATE_WP_CRON’, true ); which has stopped the BackWPup plugin from running on any schedule. This took me way longer to figure out than it probably should have, so I hope someone else finds this really useful.

Here’s what I did to get my schedules to work by triggering the manual backup links.

Add a BackWPup Job

Set the Job Schedule to Start job with a link

Add a New WP Crontrol Event Using PHP cron event

In the PHP Code, insert wp_remote_get() with the respective BackWPup Job link.
For example:

wp_remote_get( ‘https://examplewebsite.com/wp-cron.php?_nonce=1234222a5&backwpup_run=runext&jobid=1’ );

For the Event Name, give a name you can call in the Cron Schedules. Set the Next Run time. Set the Recurrence interval.

For each backup you want to run, you’ll need to set up those jobs separately and add the separate cron events & schedules.

I hope this post helped you! If you want to share some love and support my work, you can here:
Venmo: https://tr.ee/i-8jQchi4N
PayPal: https://tr.ee/Ktw6gMU8iX
Thank you!