How to add llms.txt to WordPress
Four working methods as of mid-2026, ranked from least-technical to most-technical. Pick the one that matches your hosting and your tolerance for poking around the file system. The whole process takes about ten minutes once you've picked your path.
Before you start: generate the file
All four methods below assume you already have an llms.txt file
ready to upload or paste in. If you don't, you have two options:
-
Generate it automatically. Lab451 produces a
spec-compliant
llms.txtin about 30 seconds — paste your domain, click Generate, download the file. Free for sites under 50 pages. - Write it by hand. If your site is small or you want full editorial control, copy the spec from the complete guide and write 30–60 lines of Markdown yourself.
Either way, you should end up with a plain-text file named
llms.txt (lowercase, no .md extension, no BOM)
that starts with an # heading and contains your site name,
a one-paragraph summary, and a few H2 sections of Markdown links. Hold
onto it — you'll need it in a minute.
Which method to pick
WordPress is a sprawling ecosystem and the right answer depends on which flavor you're running. Quick decision tree:
- WordPress.com Business plan or higher? → Method 1. Built in.
- Self-hosted (WordPress.org) and you'd rather not touch files? → Method 2. Plugin.
- Self-hosted and you have SFTP access? → Method 3. Direct upload.
- Self-hosted and you want the file generated dynamically? → Method 4. functions.php.
- WordPress.com Free, Personal, or Premium plan? → none of these work. You'd need to upgrade to Business, or move to self-hosted WordPress.
Method 1 — WordPress.com (Business plan and up)
WordPress.com shipped native llms.txt support in January 2026.
If you're on Business, Commerce, or Enterprise, it's the easiest path —
no plugin, no file uploads, no code.
- Log into your WordPress.com dashboard.
- Navigate to Tools → Marketing → llms.txt. (The path moved twice in early 2026; if you don't see it there, search the help docs for "llms.txt" — it's somewhere in the sidebar.)
- Either let the platform auto-generate your file from your site structure, or paste in custom content (e.g. the file you got from Lab451).
- Save. The file is now live at
yourdomain.com/llms.txt.
Note: this feature is limited to Business and above. Free, Personal, and
Premium plans can't add static root files and can't install
plugins, which means there's no path to llms.txt on those
tiers without upgrading or migrating.
Method 2 — Plugin (easiest for self-hosted)
For self-hosted WordPress.org sites, a dedicated plugin is the lowest-friction option. Three are worth knowing about:
- Website LLMs.txt — purpose-built plugin, free in the WordPress repository. Generates from your post/page structure, lets you override content, serves the file at the correct path.
-
Rank Math (experimental) — the popular SEO plugin added experimental
llms.txtsupport in early 2026. If you already use Rank Math, look under Rank Math → General Settings → llms.txt. - Yoast SEO — has signalled it's coming but isn't shipped as of this writing. Worth checking the changelog if you already use Yoast.
For the general workflow with Website LLMs.txt:
- From your WP admin, go to Plugins → Add New and search for "llms.txt".
- Install and activate the plugin.
- Visit the plugin's settings page (usually under Settings or its own top-level menu item).
- Either accept the auto-generated content, or paste in your own (your Lab451-generated file works perfectly here).
- Save and verify at
yourdomain.com/llms.txt.
Plugin gotcha: some plugins auto-update the file on a schedule, which can overwrite any manual edits you've made. If you want editorial control, check the plugin settings for an "auto-refresh" toggle and turn it off. Otherwise your carefully-curated blockquote summary gets replaced with whatever the plugin's default template produces.
Method 3 — SFTP / file manager upload
The classic approach: just upload the file directly. Works on every self-hosted WordPress installation regardless of plugins, theme, or host. The only tricky part is putting it in the right directory.
- Connect to your site via SFTP (FileZilla, Cyberduck, Transmit) using credentials from your host.
-
Navigate to your WordPress document root. This is the directory that contains
wp-config.php,wp-load.php, and thewp-content/folder. On most hosts it's calledpublic_html/,www/, orhtdocs/. - Upload your
llms.txtfile directly into that directory. Not intowp-content/, not into a subfolder. Same level aswp-config.php. - Verify the file permissions are
644(readable by everyone, writable only by owner). - Open
yourdomain.com/llms.txtin a browser. You should see plain text, not your theme.
If your host uses a control panel like cPanel, Plesk, or DirectAdmin, you can do the same thing through the File Manager interface — same target directory, same rules.
Managed host? If you're on WP Engine, Kinsta, Pressable, Flywheel, or similar, the document root is usually named public/ or web/ rather than public_html/. Check your host's docs for "static file uploads" or "custom root files." Some managed hosts don't allow direct root uploads — use Method 4 (functions.php) instead.
Method 4 — functions.php rewrite (most flexible)
The most powerful option: generate llms.txt dynamically from
PHP. This is the right approach if:
- Your host won't let you upload static files to the root.
- You want the file regenerated automatically when content changes.
- You want full programmatic control over what goes in it.
The basic shape: hook into WordPress's init action, check
whether the request is for /llms.txt, and if so, output
your content with the correct Content-Type header. Add
this to your child theme's functions.php (never the
parent theme — it'll get wiped on update) or, better, a small custom
plugin:
<?php
/**
* Serve llms.txt at the document root.
* Drop this in a child theme's functions.php or a tiny custom plugin.
*/
add_action('init', function () {
// Match the exact path; ignore query strings.
$path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
if ($path !== 'llms.txt') return;
header('Content-Type: text/plain; charset=utf-8');
header('Cache-Control: public, max-age=3600');
// Option A: static content, edited manually.
echo "# Your Site Name\n\n";
echo "> One-paragraph summary of what your site is about.\n\n";
echo "## Main Pages\n\n";
echo "- [Home](" . esc_url(home_url('/')) . ")\n";
echo "- [About](" . esc_url(home_url('/about/')) . ")\n";
echo "- [Contact](" . esc_url(home_url('/contact/')) . ")\n\n";
// Option B: dynamically pull recent posts.
$posts = get_posts(['numberposts' => 10, 'post_status' => 'publish']);
if ($posts) {
echo "## Recent Posts\n\n";
foreach ($posts as $p) {
echo "- [" . esc_html($p->post_title) . "](" . esc_url(get_permalink($p)) . ")\n";
}
}
exit;
});
Adjust to taste. The function fires before WordPress loads the theme,
which means it's fast, doesn't render any HTML wrappers, and serves
pure text. Test by visiting yourdomain.com/llms.txt in
a browser.
Don't edit the parent theme's functions.php. The next theme update will overwrite your changes. Use a child theme or — better — a tiny custom plugin (a single .php file in wp-content/plugins/ with a plugin header comment). Plugins survive theme switches and theme updates.
Verify it's actually working
Regardless of which method you used, run this checklist before declaring victory:
-
Visit
yourdomain.com/llms.txtin an incognito window. You should see plain Markdown text. No HTML wrapper, no theme, no nav bar. If you see your site's homepage, the file isn't being served correctly. -
Check the response headers. In your browser's dev tools, look at the Network tab when loading
/llms.txt. TheContent-Typeshould betext/plainortext/markdown. The HTTP status should be 200. -
Validate the Markdown. The file should start with exactly one
#heading, have a single>blockquote near the top, and use##H2 sections for link lists. The llmstxt.org parser is unforgiving about deviations. -
Test with the actual AI crawlers. Wait a few days, then check your server logs for hits from
GPTBot,ClaudeBot,PerplexityBot, etc. on/llms.txt. If they're showing up, you're golden.
Troubleshooting the common failures
"/llms.txt returns 404"
Almost always a path issue. Confirm you uploaded the file to the
WordPress document root (where wp-config.php lives),
not into wp-content/ or wp-admin/. If the
path is correct, your host may have a security rule blocking arbitrary
root files — check your host's docs or open a support ticket asking
them to confirm .txt files are served from the root.
"/llms.txt returns my theme's homepage"
Your .htaccess or WordPress's rewrite rules are catching
the request and routing it to index.php. Solutions, in
order of preference: (a) make sure the file physically exists at the
root and is readable, (b) check your .htaccess for a
rewrite catch-all that's too greedy, (c) explicitly whitelist
llms.txt in your rewrite rules.
"The file shows but it's wrapped in my theme's HTML"
Specific to Method 4 — your function isn't calling exit;
after the echo statements, so WordPress continues loading the theme
on top of your output. Add exit; at the end of the
handler.
"The plugin overwrote my custom content"
Most llms.txt plugins have an auto-refresh feature that regenerates the file on a schedule. Find the setting (usually called "auto-update," "auto-refresh," or "regenerate") and disable it if you want editorial control over the content.
"Caching plugin is serving a stale version"
WP Rocket, W3 Total Cache, and similar plugins sometimes cache static
files at the root. After updating llms.txt, manually
purge your cache. Some plugins let you exclude specific URLs from
caching — add /llms.txt to the exclusion list.
Maintenance: keeping it fresh
A stale llms.txt is worse than no llms.txt
— it tells AI models things about your site that aren't true anymore.
Bake regeneration into your routine.
- Static files (Methods 1, 3): regenerate monthly, or whenever you make significant changes to your site structure (new product pages, new docs sections, retired sections).
- Plugin-managed (Method 2): if auto-refresh is on, it handles itself. Spot-check the output once a quarter.
- Dynamic (Method 4): always current by definition. Just make sure your PHP logic still reflects the structure you want.
Whatever cadence you pick, treat your llms.txt like your
sitemap.xml — a living file that needs occasional
attention, not a one-time setup.
Frequently asked questions
Does this work on WordPress Multisite?
Yes — each site in the network needs its own llms.txt
at its own root URL. If your network uses subdirectories
(example.com/site1/), each subdirectory needs its own
file. If it uses subdomains (site1.example.com), each
subdomain needs its own file. Subdomains are independent.
Should I also add llms-full.txt?
Depends on what your WordPress site is. Marketing sites and small
blogs are fine with just llms.txt. Documentation sites,
knowledge bases, and content-heavy publications benefit from
llms-full.txt too. We covered the decision in detail
in llms.txt vs llms-full.txt.
Will adding llms.txt slow down my site?
No. The file is a few KB and is served once per crawler visit, typically once or twice a day per AI crawler. The performance impact is unmeasurable.
Do I need a separate llms.txt for each language?
If your site uses subdirectories per language
(example.com/en/, example.com/fr/), the
convention is one llms.txt per language directory
plus a default at the root. If you use Polylang or WPML to
serve a single domain with content-negotiated languages, one
English-language llms.txt at the root is fine for now;
the multilingual convention is still settling.
What if I'm using a page builder like Elementor or Divi?
Doesn't matter. llms.txt sits below the theme and page
builder layer — none of them touch it. Any of the four methods above
works regardless of page builder.
Should I block AI bots in robots.txt and skip llms.txt?
That's a different decision. If you don't want AI models reading
your content, block them in robots.txt and skip
llms.txt entirely. If you do want them reading your
content, add llms.txt to make their job easier. We
covered this trade-off in
the complete llms.txt guide.
Is there a WordPress.com workaround for Free/Personal/Premium plans?
Not really. Those plans don't allow plugins and don't allow root file uploads. The only path is to upgrade to Business, or migrate to a self-hosted WordPress.org installation where you have full file access.
Skip step 1: generate your file in 30 seconds
Lab451 produces spec-compliant llms.txt,
llms-full.txt, sitemap.xml, and
robots.txt for any WordPress site. Paste your URL,
click Generate, download the files, then use any of the four
methods above to deploy.