Languages: English • 日本語 中文(简体) • (Add your language)
Run scheduled callbacks or spawn cron for all scheduled events.
<?php wp_cron() ?>
None.
if ( ! wp_next_scheduled( 'my_task_hook' ) ) { wp_schedule_event( time(), 'hourly', 'my_task_hook' ); } add_action( 'my_task_hook', 'my_task_function' ); function my_task_function() { wp_mail( 'your@email.com', 'Automatic email', 'Automatic scheduled email from WordPress.'); }
wp_cron() is located in wp-includes/cron.php
.
The Plugin Handbook Cron Chapter is a great reference for coding WordPress Cron tasks.