I'd like to make this mysql command into a script and run it as a cron:

DELETE FROM xx_posts WHERE post_content=''

However, I don't know how. So the question is what should the php file look like to access and delete the empty wordpress posts from the database?
Thank you!

Member Avatar



//php file to run as cron

...db connection details...

$r = mysql_query("DELETE FROM xx_posts WHERE post_content=''");

//you could include some error or event logging too if you wanted

You should be able to set up a cronjob via cPanel or its equivalent. If you don't seem to have this facility talk to your host.

Thanks, that was the line I needed.