add_action('init', function () {
$path = parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH);
if ($path !== '/ttr-new-posts-sitemap.xml') return;
header('Content-Type: application/xml; charset=UTF-8');
$after = gmdate('Y-m-d H:i:s', time() - 30 * DAY_IN_SECONDS);
$q = new WP_Query([
'post_type' => 'post',
'post_status' => 'publish',
'date_query' => [[
'column' => 'post_date_gmt',
'after' => $after,
'inclusive' => true,
]],
'fields' => 'ids',
'posts_per_page' => 5000,
]);
echo '';
echo '