Delete oldest wordpress post (SQL query)
Question
I’ve reached the database limit on my hosting platform. I want to add a function to my functions.php that deletes the oldest post in my database anytime that I publish a new post.
function deleteOldestPost(){
global $wpdb;
$prefix = $wpdb->prefix;
$wpdb->query("DELETE code");
}
add_action('publish_post', 'deleteOldestPost');
Can someone please help me with the appropriate query?
0
functions, mysql, query, sql, wpdb
3 years
2020-06-01T14:10:24-05:00
2020-06-01T14:10:24-05:00 0 Answers
91 views
0
Leave an answer