Using Cron to schedule events in WordPress

August 12, 2009

WordPress can schedule events. but how you create an event that will be executed once hourly, or daily, etc? Just copy following code to your functions.php file: if (!wp_next_scheduled('live_task_hook')) { wp_schedule_event( time(), 'hourly', 'live_task_hook' ); } add_action( 'live_task_hook', 'live_task_function' ); function live_task_function() { wp_mail('you@yoursite.com', 'Automatic email', 'Hello, this is an automatically scheduled email from Live Experience.'); } On line 1, we created an event, after verifying... [Read the full story]

Disable wordpress posts auto saving

August 12, 2009

WordPress have a very useful function that autosaves your posts while you’re typing them in the dashboard. Though, if for some reason you’d like to disable this function, it is very easy to do. To disable WordPress autosaving function, simply open your functions.php file and paste the following code: function disableAutoSave(){ wp_deregister_script('autosave'); } add_action( 'wp_print_scripts', 'disableAutoSave' ); Once you saved the file, WordPress will never autosave a post. To enable autosaving again,... [Read the full story]