I have a plugin that updates the content of a post from other sources, but I want to delete the post if no new content is found. Please look at the code snippet below. I have annotated where I want to have the code [that I can't figure out]. Your help is much appreciated.
<?php
function add_content($content)
{
global $post;
$new_content = get_new_content();
if ($new_content) {
// new content available, so update $content
$content = $new_content;
} else {
// no content, so I want to delete the post
$post_ID = $post->ID;
// Code needed here, having got the post ID
// -> To delete post & associated entries in other tables
// -> And to redirect user to another page
}
return $content;
}
add_filter('the_content', 'add_content');
?>
You help would be very much appreciated. Thanking you in advance.
Jason