Adding llms.txt to WordPress
Published:
WordPress powers a huge share of the web, and adding an llms.txt is quick. The file just has to be served at https://yoursite.com/llms.txt as plain text.
Option 1 — Upload the file (simplest)
Write your file (see how to create an llms.txt file), then upload llms.txt to the root web directory (often public_html/) via your host's file manager or SFTP. Done — no plugin needed.
Option 2 — Serve it with a snippet
If you can't write files, add a tiny route. Drop this in your theme's functions.php (or a code-snippets plugin):
add_action('init', function () {
if (trim($_SERVER['REQUEST_URI'], '/') === 'llms.txt') {
header('Content-Type: text/plain; charset=utf-8');
echo "# My Site\n\n> Short summary.\n\n## Docs\n- [Start](https://mysite.com/start): Get going\n";
exit;
}
});
Option 3 — Use a plugin
Several SEO/AI plugins now generate llms.txt from your pages automatically. Handy, but review the output — auto-generators often include too many links or marketing copy. Keep it curated.
Watch out for these
- Caching/CDN: purge your cache after publishing so the file is served.
- Right location: it must be at the domain root, not
/blog/llms.txt. - Plain text: serve as
text/plain, not HTML.
Verify it
Run your domain through the validator — it confirms the structure and that every linked page actually loads.