This is a little post to remind me how to setup a wp cron will grow to be helpfull over time
fist don't try it with code (not that hard but just clunky to track) insted use this plugin:
WP Crontrol
Setup is pretty self explanatory add cron event with the required settings pointing at a hook (usually a custom hook) eg:
<?php add_action( 'ps_custom_cron', 'ps_custom_cron_func' ); function ps_custom_cron_func() { // do something when the cron is fired }
things to note:
WPcron is triggered by client interaction with the site and therefore is not near as reliable as server cron but for most use cases it is fine (don't use if time interval is very time sensitive).