How to add llms.txt to WordPress
WordPress doesn't expose root-level files by default. The cleanest install uses a small mu-plugin or your theme's functions.php to serve /llms.txt dynamically, with SFTP as a fallback for static files.
Before you start
- ✓Admin or SFTP access to your WordPress install
- ✓An llms.txt body — generate one with the OptimAIze tool
- ✓Any caching plugin temporarily put in bypass mode while you verify
Install in 4 steps
- 1
Generate your llms.txt
Use the OptimAIze llms.txt generator to draft your file. Copy the Markdown body to your clipboard.
- 2
Drop the file in the WordPress root
SFTP into your site and place llms.txt next to wp-config.php. WordPress passes through root-level static files, so this works without code.
- 3
Or serve it dynamically
Add an init hook in a mu-plugin (wp-content/mu-plugins/llms-txt.php) that catches /llms.txt requests and outputs your content with the text/plain header. This survives WP updates and lets you template the file.
- 4
Verify
Open yoursite.com/llms.txt in a browser. Confirm UTF-8 encoding, text/plain content-type, and no caching plugin rewriting it to HTML.
Troubleshooting
Your security plugin (Wordfence, iThemes Security) is blocking unknown root files. Whitelist /llms.txt explicitly.
A caching plugin is rewriting the response. Add /llms.txt to the cache exclusion list and purge.
Cloudflare or WP Super Cache is serving a cached copy. Purge both layers.
Common gotchas
- • Some security plugins (Wordfence, iThemes) block unknown root files — whitelist /llms.txt
- • Caching plugins may serve a stale or HTML-wrapped version — exclude the path
- • If you use Cloudflare, purge the cached version after each update
Generate your llms.txt in 30 seconds
Use the free OptimAIze generator, then follow the steps above to deploy on WordPress.
Frequently asked questions
Does WordPress need both llms.txt and robots.txt?
Yes. robots.txt grants crawler permission; llms.txt curates which pages matter. Together they form the minimum AI-search setup on any WordPress site.
Will adding llms.txt slow down my site?
No. It's a tiny static text file fetched once and cached aggressively. Page-load impact is effectively zero.
How often should I update llms.txt?
Whenever your canonical content set changes — new docs section, new product line, new pricing page. A monthly review is a sensible cadence for most sites.
Can I see whether AI engines read my llms.txt?
Check your server logs for user agents like GPTBot, ClaudeBot, PerplexityBot, and Google-Extended hitting /llms.txt. Most sites see traffic within days of publishing.