When I build this website, i need function to delete chace periodically. So i create some function, this my function in wordpress
<?php
define(‘PATH’, ‘wp-content/plugins/simplepie-core/cache/’);
function destroy($dir) {
$mydir = opendir($dir);
while(false !== ($file = readdir($mydir))) {
if($file != “.” && $file != “..”) {
chmod($dir.$file, 0777);
if(is_dir($dir.$file)) {
chdir(‘.’);
echo “deleting ” . $dir.$file;
destroy($dir.$file.’/');
rmdir($dir.$file) or DIE(“couldn’t delete $dir$file<br />”);
}
else
echo “deleting ” . $dir.$file;
unlink($dir.$file) or DIE(“couldn’t delete $dir$file<br />”);
}
}
closedir($mydir);
}
destroy(PATH);
echo ‘all done.’;
?>
After i create that function, i save file with name clear.php.
After that i upload that file in domain root my website, and i login to hostgator panel and click cron job button.
After that you must insert your email.
Because i want my function excute every 30 minutes so i setting my cron jobs like picture bellow
I hope this useful for you.

