Tutorial · WordPress · GEO

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.

· 11 min read · Lab451

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:

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:

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.

  1. Log into your WordPress.com dashboard.
  2. 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.)
  3. 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).
  4. 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:

For the general workflow with Website LLMs.txt:

  1. From your WP admin, go to Plugins → Add New and search for "llms.txt".
  2. Install and activate the plugin.
  3. Visit the plugin's settings page (usually under Settings or its own top-level menu item).
  4. Either accept the auto-generated content, or paste in your own (your Lab451-generated file works perfectly here).
  5. 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.

  1. Connect to your site via SFTP (FileZilla, Cyberduck, Transmit) using credentials from your host.
  2. Navigate to your WordPress document root. This is the directory that contains wp-config.php, wp-load.php, and the wp-content/ folder. On most hosts it's called public_html/, www/, or htdocs/.
  3. Upload your llms.txt file directly into that directory. Not into wp-content/, not into a subfolder. Same level as wp-config.php.
  4. Verify the file permissions are 644 (readable by everyone, writable only by owner).
  5. Open yourdomain.com/llms.txt in 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:

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:

  1. Visit yourdomain.com/llms.txt in 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.
  2. Check the response headers. In your browser's dev tools, look at the Network tab when loading /llms.txt. The Content-Type should be text/plain or text/markdown. The HTTP status should be 200.
  3. 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.
  4. 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.

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.

Generate my files →