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?