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

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 …

Jump to Post

All 2 Replies

Member Avatar

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.