WordPress tutorial · Updated 2026

How to Add llms.txt to WordPress (2026 Guide)

WordPress powers more than 40% of the web — but adding llms.txt to WordPress is different from a static site. This guide covers three proven ways to add llms.txt to WordPress in 2026: uploading a generated file, using a WordPress llms.txt plugin such as Yoast SEO, or adding a few lines of code. No matter which method you pick, you'll be done in under ten minutes.

Why llms.txt Is Different on WordPress

On a static site, adding llms.txt is trivial: drop a file into the build folder and redeploy. On WordPress it's trickier, for three reasons. First, WordPress sites are dynamic — posts, pages, categories, tags, archives and pagination are generated from the database, so a site can easily expose hundreds or thousands of URLs. Second, the plugin ecosystem is where WordPress SEO actually happens: the tools that already manage your robots.txt and sitemap are the natural home for llms.txt too. And third, WordPress adds infrastructure concerns that static sites don't have — caching plugins, multisite networks and subdirectory installs can all silently break an llms.txt file.

The good news: because llms.txt is just a plain Markdown file served at https://your-domain.com/llms.txt, every method below works with any WordPress host — shared hosting, managed WordPress, or a VPS.

Method 1 (Recommended): Upload a Generated llms.txt to Your Site Root

The fastest, most reliable way to add llms.txt to WordPress requires no plugins and no code: generate the file, then upload it to the root of your WordPress installation. You keep full control over what goes into the file, and there is nothing to break later.

  1. Generate your file. Use the free llms.txt generator — enter your URL, pick the pages you want AI engines to read, and download the resulting llms.txt file.
  2. Find your WordPress root. The root is the folder that contains wp-config.php — usually /public_html (cPanel and most shared hosts), /var/www/html, or whichever folder your hosting file manager opens first. If WordPress is installed in a subdirectory (for example example.com/blog/), the root is that subdirectory, not the document root above it.
  3. Upload the file there. Three ways, pick one:
    • Hosting file manager: open public_htmlUpload → select llms.txt.
    • cPanel File Manager: navigate to public_htmlUpload, then move the file if needed.
    • FTP/SFTP: connect with FileZilla or any FTP client, open /public_html/, and drag the file in.
  4. Verify. Open https://your-domain.com/llms.txt in a browser — you should see your file rendered as plain text, not a 404 or the homepage.

Two notes. Don't upload the file inside wp-content/themes/…: theme updates can delete it. And if your site serves through Cloudflare or another CDN, purge the cache after uploading so visitors and AI crawlers get the fresh copy.

Method 2: Use a WordPress llms.txt Plugin

If you prefer automation — especially on a busy site where content changes daily — a WordPress llms.txt plugin is the way to go. Plugin-generated files stay in sync with your content, respect your noindex rules, and need zero maintenance:

MethodDifficultyBest for
Upload a generated file (Method 1)Easy — no pluginsFull control, one-time setup, any host
WordPress llms.txt plugin (Method 2)Easiest — automaticFrequently updated sites, non-technical owners
Code in a child theme (Method 3)Intermediate — PHPDevelopers who want zero extra plugins

Method 3: Add llms.txt to WordPress with Code

If you'd rather not install another plugin, a few lines of PHP serve your llms.txt file directly from your theme. Two rules first: never edit WordPress core files (wp-includes, wp-admin, or the bundled default themes), and always use a child theme so a parent theme update can't wipe your changes.

Step 1 — create the file llms.txt inside your child theme folder (for example wp-content/themes/my-theme-child/llms.txt) and paste in your generated content.

Step 2 — add this snippet to your child theme's functions.php:

Step 3 — flush the rewrite rules once: go to Settings → Permalinks and click Save Changes (no other change needed). The snippet registers /llms.txt as a route, then serves your theme's file with the correct text/plain content type.

What to Put in a WordPress llms.txt File

Here is the temptation to resist: your WordPress site can produce hundreds of URLs — posts, pages, categories, tags, author archives, pagination, media attachments, WooCommerce products. Do not list all of them. An llms.txt file is a curated index: AI agents read it first and treat it as "these pages are worth reading." A giant auto-generated list dilutes your most important content and wastes the agent's context window.

Include your homepage, about page, key landing pages, best articles, documentation and top products. Exclude tag and category archives, paginated listings, admin pages, and anything marked noindex. A healthy WordPress llms.txt is usually 10–30 links:

# Example Coffee Co.

> A specialty coffee roaster in Portland, Oregon — beans, brewing guides, and our story.

## Important links

- [Home](https://example.com/): Storefront, featured products, and seasonal offers
- [Shop](https://example.com/shop/): All coffees and brewing equipment
- [Brewing guides](https://example.com/guides/): Step-by-step recipes for every method
- [About us](https://example.com/about/): Our story and sourcing philosophy

Common llms.txt WordPress Pitfalls

  • Caching plugins serve stale files. WP Rocket, W3 Total Cache, LiteSpeed Cache and Cloudflare can all cache /llms.txt and keep serving an old version after you update it — which is exactly how an AI engine ends up citing a deleted page. After every change, purge the page cache and the CDN cache, and consider excluding /llms.txt from caching entirely.
  • WordPress in a subdirectory. If your site lives at example.com/blog/, the file goes in the blog/ folder, not public_html — otherwise agents fetch example.com/llms.txt and get a 404.
  • Multisite networks. Each site in a WordPress multisite should have its own llms.txt at its own root: a subdomain site's file goes in that subdomain's root, a subdirectory site's file in that subdirectory.
  • Redirects and plugins hijacking the path. Some hosts or security plugins redirect unknown paths to the homepage. After deploying, confirm /llms.txt returns a 200 with a text/plain content type — not a redirect to /.

WordPress llms.txt FAQ

Does Yoast SEO support llms.txt in 2026?

Yes. llms.txt generation is built into both the free and premium versions of Yoast SEO. Enable it under Yoast SEO → Settings → Site Features → AI tools → LLMS.txt. Yoast picks your most important and recently updated pages, respects noindex rules, and regenerates the file weekly.

Will a caching plugin break my llms.txt file?

It can — a page cache may keep serving an old copy after you update the file. Purge your page cache and CDN cache after every change, and if you can, exclude /llms.txt from caching so crawlers always get the current version.

Do I need llms.txt if I already have a sitemap?

Keep both — they serve different purposes. An XML sitemap lists every URL for search-engine crawlers; llms.txt is a short, curated, Markdown index that AI agents read directly. A WordPress site should ship both: Yoast handles the sitemap, and any of the three methods above handles llms.txt.

Ready to add llms.txt to WordPress?

Generate your file in under a minute, then validate it against the spec — free, no sign-up, works with any of the three methods above.

⚡ Generate your llms.txt Check my file