<?php
/*
Plugin Name: Delete old records from the scedule section
Description: This plugin will delete old records from the example section.
Version: 0.01
Requires at least: 2.53
*/


addCronJob('delete_old_records', "Cron Example Script", '0 8 * * *');             // Run at 8am


// this function is called by cron, and logged under: Admin > General > Background Tasks
function delete_old_records() {

  //Delete old records
  mysql_delete('schedule', null, " `date` < TIMESTAMP( DATE(NOW() - INTERVAL 2 HOUR) ) ");
  echo "Old records deleted!";
  return true;
}
