Skip to content

Must-Use Plugin: 0-sitemap-trim-output.php

Location: _project/_web/wp-content/mu-plugins/0-sitemap-trim-output.php

Purpose

Prevents stray whitespace bytes before XML declarations in Yoast SEO sitemap output. Uses ob_start() with a trim callback to clean leading whitespace.

Also sets set_time_limit(120) to allow sitemap generation to complete on large sites.

Why "0-" Prefix?

The 0- prefix ensures this mu-plugin loads first (alphabetical loading order), before any other code can output whitespace.