Hi!
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!

Recommended Answers

All 2 Replies

Member Avatar for diafol

Ok,

//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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.