I mainly use Pages (not Posts) and wanted a way to exclude Pages by the ID of their parent. Since Google XML Sitemaps didn't have this feature built in, I implemented it myself. I'm here to share the simple code.
Starting Line 1762 of sitemap-core.php, insert the following block:
foreach ($excludes as $exclude)
{
$children = get_pages(array('child_of' => $exclude));
foreach ($children as $child)
$exChildren[] = $child->ID;
}
Then at Line 1781, insert:
if (is_array($exChildren))
$excludes = array_merge($exChildren, $excludes);
That's it. If your blog breaks as a result of this, I'm not responsible.
Best,