2

Cron - Using a Plugin

Matthew Gabriel

Last Update 6 bulan yang lalu

There are a few Cron plugins freely available from the WordPress.org plugin repository with different setup options. For example, WP Crontrol enables you to create cron jobs using a URL or a WordPress hook, while with Get URL Cron, you can set them up to fetch a URL or fire a WordPress shortcode.


We’ll use Wp-Crontrol for this example. Once the plugin is installed and activated, go to Tools > Cron Events in your site’s wp-admin, and click on the Add New button.

On the next screen, enter the Hook Name to use as the trigger to fire your cron event, and any optional arguments your cronjob may need. Then set the run time and recurrence schedule, and click Add Event to finish.


If your event needs to call a file or external URL, use the WordPress wp_remote_get function in the Hook Name field to fetch the file or URL; for example:

wp_remote_get( 'http://example.com/some-file.php' );

For more information on using WP-Crontrol for your custom cron jobs, see the FAQ on the plugin’s WordPres.org page.

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us