How to Add llms.txt to WordPress (2026 Step-by-Step Guide)
WordPress doesn't have a native way to serve a custom llms.txt at the root of your domain - the file system is structured around themes, plugins, and uploads, not arbitrary root files. Three workable paths: SFTP upload (cleanest, works on any host), a virtual-file plugin (no FTP needed but requires a plugin), or a custom rewrite rule in functions.php (developer-friendly).
What you'll need before you start
- •A WordPress site you can administer (wordpress.org self-hosted - WordPress.com hosted plans block file system access on most tiers)
- •Either FTP/SFTP access to your hosting, OR ability to install plugins, OR comfort editing functions.php
- •Roughly 30 minutes including writing the content
How to add llms.txt on WordPress: Step-by-step
- 1
Write your llms.txt content first
Open a plain-text editor and draft the file content. Start with an H1 of your site name, optionally a blockquote summary, then sections (H2) of bulleted links with one-line descriptions. List 10-30 of your most important URLs. Use sections like Product, Documentation, Guides, and Optional (the last one is for "nice to have" links). Save the file as
llms.txton your local machine - we'll upload it next. - 2
Path 1 (recommended): SFTP upload to the public root
Connect to your WordPress hosting via SFTP using credentials from your hosting provider. Navigate to your site's public root - usually
public_html/,www/, or the directory containingwp-config.php. Uploadllms.txtdirectly into this directory. Confirm by visitinghttps://yourdomain.com/llms.txtin your browser - the content should appear as plain text. - 3
Path 2: virtual file via WP Headers and Footers / Code Snippets plugin
If you can't use SFTP, install the Code Snippets plugin and add a snippet that registers a custom WordPress route serving your llms.txt content. Example snippet:
add_action('init', function() { add_rewrite_rule('^llms\.txt$', 'index.php?llms_txt=1', 'top'); }); add_filter('query_vars', function($qv) { $qv[] = 'llms_txt'; return $qv; }); add_action('template_redirect', function() { if (get_query_var('llms_txt')) { header('Content-Type: text/plain; charset=utf-8'); echo "# Your Site Name\n\n## Product\n- [Homepage](https://yoursite.com): What you do\n"; exit; } });Save the snippet, then go to Settings → Permalinks and click Save (this flushes the rewrite rules so the new route works).
- 4
Path 3: functions.php rewrite (developer route)
Same approach as Path 2 but pasted directly into your child theme's
functions.phpfile. Use a child theme so the changes survive parent-theme updates. Same code as above, same need to save Permalinks settings to flush rewrites. Path 3 is cleaner if you're already maintaining a custom child theme; Path 2 is better if you don't want to touch theme files. - 5
Test that the file is being served correctly
Visit
https://yourdomain.com/llms.txtin a browser. You should see your plain-text content. Open DevTools (F12) → Network tab, refresh, click thellms.txtrequest, and check the response headers - Content-Type should betext/plain(nottext/html). If the browser downloads the file instead of displaying it, that's still acceptable - the content type just needs to be text/plain. - 6
Update llms.txt as your site evolves
llms.txt is curated, not automatic. When you publish a major new piece of content (a flagship blog post, a new feature page, a new pricing tier), edit the file to include it. If you used Path 1 (SFTP), you re-upload after editing. If you used Path 2 or 3 (rewrite rules), you edit the snippet directly. Aim to review and update the file every 1-2 months.
How to verify your setup is working
The simplest check is visiting yourdomain.com/llms.txt in your browser. The content should be plain text matching what you wrote, and DevTools should show Content-Type: text/plain. If you used the SFTP path, you can also check the file via FTP to confirm it's exactly where you uploaded it. Beyond presence, the format itself isn't validated by any official tool yet - the proposed spec at llmstxt.org has examples to compare against.
Common issues and fixes
Visiting /llms.txt returns a 404 even though I uploaded it
Most often a path issue. Confirm you uploaded the file to the WordPress public root (where wp-config.php lives), NOT into wp-content/ or wp-admin/. If the path is correct, your hosting may have a security rule blocking arbitrary root files - check your hosting provider's documentation or contact support to confirm .txt files are served from the root.
I'm using a managed WordPress host (WP Engine, Kinsta, Pressable) and SFTP doesn't show a place to upload
Managed hosts typically allow SFTP into a specific directory; the public root for the live site is usually called public/ or web/ rather than public_html/. Check your host's docs for "static file uploads" or "custom root files." If your host doesn't allow direct file uploads to root (some don't), use Path 2 (Code Snippets plugin) instead.
The Code Snippets / functions.php rewrite isn't working - 404 persists
Two usual causes. (1) You didn't save Permalinks settings (Settings → Permalinks → Save). WordPress only refreshes rewrite rules when you save that page. (2) A caching plugin is intercepting the request before WordPress sees it. Add a cache exclusion for /llms.txt in your caching plugin's settings, or temporarily disable the plugin to test.
Frequently asked questions
Can I add llms.txt to WordPress.com?
Only on the Business plan and above (which allow plugins and SFTP-equivalent file access). The Free, Personal, and Premium plans don't allow root-level static files OR plugins. The cheapest path to llms.txt on WordPress.com is the Business plan; otherwise, switch to wordpress.org self-hosted.
Is there a WordPress plugin that handles llms.txt automatically?
As of early 2026, dedicated llms.txt plugins are still nascent. Some SEO plugins (Rank Math has experimental support) are starting to add llms.txt generation features, but the most reliable path is still manual - either SFTP-uploading your own file or using a Code Snippets / functions.php rewrite. Manual is also better because llms.txt benefits from human curation; auto-generated files tend to include too much.
Should llms.txt list every page on my WordPress site?
No - the value is curation. Aim for 10-30 important pages. Including every URL is noise; AI crawlers won't actually read all of them. Use the Optional section for supplementary links you want to mention but don't want bloating the main sections.
Does llms.txt help with SEO rankings on Google?
Not directly - Google's standard ranking algorithm doesn't use llms.txt as of early 2026. The benefit is for AI search engines (ChatGPT, Perplexity, Claude, Gemini) and AI Overviews citation behavior. Adding llms.txt is part of the broader Generative Engine Optimization (GEO) playbook, not traditional SEO.
Can I have both llms.txt and robots.txt on WordPress?
Yes - they serve different purposes and don't conflict. robots.txt tells crawlers what NOT to access; llms.txt tells AI crawlers what IS important to read. WordPress generates a virtual robots.txt automatically, but you can override it with a real robots.txt file uploaded to the public root (same path as llms.txt).
How do I know AI assistants are reading my llms.txt?
You can check your server logs for User-Agents like ChatGPT-User, PerplexityBot, ClaudeBot, and Google-Extended requesting /llms.txt. The more direct signal is whether your site is being cited by AI assistants - track this with MeasureBoard's AI Rank Tracker, which queries each major AI for chosen prompts and tracks how often your domain appears in the answers.
Related Guides
Once you're set up, MeasureBoard turns the data into action
MeasureBoard connects to your analytics, search, and SEO tooling and generates AI-powered weekly reports, GEO readiness scores, and a dedicated AI analyst that answers questions in plain English. Free to start, connects in 30 seconds.
Get Started Free