/ โ† llms.txt Fixes / llms.txt in WordPress
In this guide
  1. Four ways to publish the file
  2. How WordPress decides what to send for /llms.txt
  3. The custom mu-plugin method
  4. The fix, step by step
  5. WordPress symptoms and their causes
  6. Hosting and platform differences
  7. Keeping a WordPress llms.txt current
  8. Questions and answers

Four ways to publish the file

There is no built-in llms.txt feature in WordPress core, so every method relies on either a real file on disk or a plugin that answers the request. Pick one. Running two at once is the single most common cause of confusing results.

MethodHow it worksGood forWatch out for
SEO plugin settingYour existing SEO plugin builds the file from your posts and pagesSites already using that plugin that want low effortAutomatic notes are often thin; limited control over which pages appear
Dedicated llms.txt pluginA single-purpose plugin generates the file, often with llms-full.txt tooSites wanting more options than their SEO plugin offersOne more plugin to maintain; check it is actively updated
Uploaded static fileYou write llms.txt by hand and upload it next to wp-config.phpSmall sites that change rarely; full control of wordingGoes stale unless someone updates it; shared by every site on a multisite network
Small custom mu-pluginA few lines of PHP answer /llms.txt with content you controlDevelopers, multisite networks, sites with a build processNeeds pretty permalinks and a rewrite flush; you own the code

At the time of writing, Yoast SEO, Rank Math and All in One SEO each include an llms.txt option, and several standalone plugins exist. Their settings move between releases, so follow the plugin's own documentation for where the switch lives. Whatever tool generates the file, read the result: generators tend to list recent posts with their excerpts as notes, which is a starting point rather than a finished file. The guide to thin llms.txt content explains what to improve.

A reminder about expectations: llms.txt is a proposal made by Jeremy Howard in 2024, and as far as we know no major AI provider has confirmed that its search or answer products use it. Setting it up in WordPress is quick and low risk, but it is not a substitute for crawlable, well structured pages.

How WordPress decides what to send for /llms.txt

Most WordPress problems with llms.txt come down to the order in which the web server and WordPress get to answer the request.

  1. The web server checks for a real file first. The standard WordPress rules for Apache send a request to index.php only if no file or folder of that name exists, and typical nginx set-ups do the same with try_files $uri $uri/ /index.php?$args. So an llms.txt file sitting in the web root always wins.
  2. If there is no file, WordPress loads. A plugin that has registered a rewrite rule for llms.txt, or that checks the request early, can then answer it.
  3. If nothing claims the request, WordPress shows your theme's 404 page, with a 404 status and an HTML content type.

That order explains the most confusing symptom: you change the plugin settings and nothing happens. An old hand-uploaded file, or one a plugin wrote to disk months ago, is still in the web root and is being served instead. Check for it before anything else.

# From the WordPress root, over SSH
ls -la llms.txt llms-full.txt

# Or with WP-CLI, confirm permalinks are not set to Plain
wp option get permalink_structure

An empty result from the second command means Plain permalinks are in use. Rewrite-based methods cannot answer /llms.txt in that mode, because WordPress is not handling pretty URLs at all. Switch to any other structure under Settings, Permalinks, or use an uploaded file instead.

๐Ÿ’ก Some plugins write a physical file to disk rather than answering dynamically. If you later switch that plugin off, the file it wrote may stay behind and keep being served. Delete it by hand when you change methods.

The custom mu-plugin method

If you want full control without another plugin, a must-use plugin can serve the file. Save this as wp-content/mu-plugins/serve-llms-txt.php (create the folder if it does not exist). It reads a Markdown file you maintain in wp-content/llms/, with one file per site so that it also works on multisite.

<?php
/**
 * Plugin Name: Serve llms.txt
 * Description: Answers /llms.txt with a Markdown file from wp-content/llms/.
 */

add_action( 'init', function () {
    add_rewrite_rule( '^llms\.txt$', 'index.php?serve_llms_txt=1', 'top' );
} );

add_filter( 'query_vars', function ( $vars ) {
    $vars[] = 'serve_llms_txt';
    return $vars;
} );

// Priority 0 runs before WordPress's canonical redirect (priority 10),
// so the URL is never rewritten to /llms.txt/ with a trailing slash.
add_action( 'template_redirect', function () {
    if ( ! get_query_var( 'serve_llms_txt' ) ) {
        return;
    }
    $file = WP_CONTENT_DIR . '/llms/llms-' . get_current_blog_id() . '.md';
    if ( ! is_readable( $file ) ) {
        status_header( 404 );
        header( 'Content-Type: text/plain; charset=utf-8' );
        echo "Not found\n";
        exit;
    }
    status_header( 200 );
    header( 'Content-Type: text/plain; charset=utf-8' );
    header( 'Cache-Control: public, max-age=3600' );
    readfile( $file );
    exit;
}, 0 );

After uploading it, flush the rewrite rules once, either by visiting Settings, Permalinks and pressing Save without changing anything, or with wp rewrite flush. Then put your file at wp-content/llms/llms-1.md for a single site; on multisite, each site uses its own blog ID in the file name. You can find the ID for each site under Network Admin, Sites.

The same pattern extends to llms-full.txt with a second rule and file. Keep generation, such as a script that rebuilds the Markdown on publish, separate from serving, so the serving code stays this small.

โš ๏ธ Test on a staging copy first. A syntax error in a must-use plugin takes the whole site down, because mu-plugins load on every request and cannot be switched off from the dashboard. Keep SFTP or file manager access open while you try it.

The fix, step by step

Step 1

Find out what currently answers at /llms.txt

Run the llms.txt Auditor, then request /llms.txt with curl -sI and note the status code, content type and any caching headers. Look in the web root over SFTP or your host's file manager for a physical llms.txt or llms-full.txt. Then list every active plugin that mentions llms.txt, including your SEO plugin's settings, so you know exactly which sources could be producing the response.

Step 2

Choose one method and remove the others

Decide on a single source: the SEO plugin setting, a dedicated plugin, an uploaded file or a mu-plugin. Switch off the llms.txt feature in every other plugin, deactivate any standalone llms.txt plugin you are not keeping, and delete leftover physical files from the web root if you are not using the upload method. Two generators, or a stale file hiding a plugin, is the usual reason changes never appear.

Step 3

Set up the file with the chosen method

For a plugin, enable the feature, choose which post types and pages to include, exclude archives and anything noindexed, then edit the summary and notes if the plugin allows it. For an upload, save a UTF-8 Markdown file named llms.txt next to wp-config.php. For the mu-plugin, upload the PHP file and your Markdown, then flush the rewrite rules from the Permalinks screen or with wp rewrite flush.

Step 4

Make sure WordPress serves plain text

Request the file again and confirm a 200 status and a Content-Type of text/plain or text/markdown with a UTF-8 charset. An HTML content type means your theme's 404 page or a redirect is answering instead. A 301 to /llms.txt/ means the canonical redirect is adding a trailing slash, which the mu-plugin avoids by running early. If permalinks are set to Plain, change them or use the uploaded file method.

Step 5

Exclude the file from caches and bot blocks

In your page cache plugin, whether WP Rocket, LiteSpeed Cache, W3 Total Cache or another, add /llms.txt and /llms-full.txt to the never-cache list, or purge them whenever the file changes. Purge the CDN copy too. Check that your security plugin and any maintenance mode do not challenge or block crawlers requesting these paths, and that robots.txt, which your SEO plugin may generate, does not disallow them.

Step 6

Handle multisite and staging copies

On a multisite network, remember that all sites share one web root, so a single uploaded llms.txt is served for every site. Use a plugin or the mu-plugin with one file per blog ID instead. On staging sites, make sure the file does not list staging URLs, and after copying staging to live, open the live file and confirm every link uses the live domain.

Step 7

Verify from outside and re-run the audit

From a private browser window, open /llms.txt on both the www and non-www host names and on http and https, and check that each either serves the file or redirects once to the canonical version. Read the content to confirm it is the version you expect. Then run the llms.txt Auditor again and work through any format, link or content findings it still reports.

WordPress symptoms and their causes

What you seeLikely causeFix
404 page in your theme's designNo file on disk and no plugin answering; or rewrite rules not flushed; or Plain permalinksEnable one method; save the Permalinks screen; change from Plain
Settings changes never appearAn old physical file in the web root is served first; or a page or CDN cacheDelete the stale file; purge caches; exclude the path from caching
Loads, but shows HTML source or theme stylingThe request falls through to a theme templateCheck which plugin should answer; confirm it sends a text content type
Redirects to /llms.txt/WordPress canonical redirect adding a trailing slashAnswer the request before redirect_canonical runs, or use a physical file
Every network site shows the same fileA single uploaded file in the shared web rootServe per site with a plugin or the mu-plugin above
Links point at the staging domainFile generated or written on staging and copied acrossRegenerate on live, or search and replace the host name
Garbled characters such as รขโ‚ฌโ„ขFile saved in a non-UTF-8 encoding, or no charset in the headerSave as UTF-8 without a byte order mark; send charset=utf-8
Auditor gets 403, browser worksSecurity plugin or host firewall refusing automated requestsAllow the path and the crawlers you want in the firewall rules

Hosting and platform differences

Managed WordPress hosts

Most managed hosts give you SFTP or a file manager, so any of the four methods works. Some add their own server-level page caching that ignores WordPress cache plugins; if the file does not update, use the host's purge button or ask support to exclude /llms.txt from the server cache.

WordPress.com

On WordPress.com plans that do not allow plugins or file access, you cannot place a file at the root of the site. Plans that allow plugins can use a plugin-based method. Check your plan's features before spending time on it.

Subdirectory installs

If WordPress lives at example.co.uk/blog/ and the rest of the site is something else, the file belongs at the domain root, which WordPress does not control. Put it there by hand or through whatever runs the main site, and list the blog's key pages in it.

Headless WordPress

When WordPress only supplies content to a separate front end, such as a Next.js or Astro site, the front end owns the root of the domain. Generate the file there at build time from the WordPress REST API or GraphQL data. Treat it like any other static or framework site: the file is built alongside the pages, not served by WordPress.

Keeping a WordPress llms.txt current

WordPress sites change constantly, which is both the advantage of generating the file and the risk of writing it by hand.

For links that stop working and files that drift from the site, see broken links in llms.txt and a stale llms.txt.

Questions and answers

1. Which WordPress plugin should I use for llms.txt?

If you already use Yoast SEO, Rank Math or All in One SEO, try its built-in llms.txt option first, since it avoids adding another plugin. Choose a dedicated plugin only if you need features your SEO plugin lacks, such as detailed control over sections or an llms-full.txt file. Whichever you choose, use only one, check that it is actively maintained, and edit the generated notes where possible, because automatic descriptions are usually thin.

2. Why does my WordPress llms.txt return a 404?

Usually one of three things. No method is active, so nothing answers the request. Rewrite rules have not been refreshed after enabling a plugin or adding code, which saving the Settings, Permalinks screen fixes. Or permalinks are set to Plain, in which case WordPress does not handle pretty URLs and rewrite-based methods cannot work. An uploaded physical file avoids all three, because the web server serves it before WordPress loads.

3. Where do I upload llms.txt in WordPress?

Upload it to the folder that contains wp-config.php, wp-content and wp-admin, which is the web root for a standard install. On many hosts this is called public_html, httpdocs or www. Then open the file at your domain followed by /llms.txt to check it loads. If WordPress is installed in a subfolder but your site address is the domain root, the file still needs to be at the domain root, not inside the WordPress folder.

4. I changed my plugin settings but llms.txt did not update. Why?

The most likely reason is that a physical llms.txt file exists in the web root, left by an earlier upload or a plugin that wrote to disk, and the web server serves it before WordPress gets a chance to answer. Delete it. The next most likely reason is caching: a page cache plugin, server cache or CDN is holding the old version. Purge them and exclude the path from caching so future changes appear straight away.

5. How does llms.txt work on WordPress multisite?

All sites in a network share one web root, so a single uploaded file is served for every site, whether you use subdomains or subdirectories. That is rarely what you want. Use a plugin that supports multisite, or a small must-use plugin that serves a different file for each site based on its blog ID. With a subdirectory network, remember that only the main domain root is checked by tools, so subsites may need their own sections in the main file.

6. Will adding llms.txt to WordPress affect my SEO?

Not in any way that has been shown. Google has not said it uses llms.txt for ranking, and a text file at the root does not change how your pages are crawled or indexed. The main risks are practical ones: a misconfigured plugin redirecting or returning errors, or a file that lists noindexed or private pages. Set it up carefully, keep it accurate, and treat it as a small extra for AI tools rather than an SEO tactic.

7. Should my robots.txt mention llms.txt?

There is no need. robots.txt controls which crawlers may fetch which paths, and llms.txt is found by its fixed location, not by a reference in robots.txt. What matters is that robots.txt does not accidentally disallow /llms.txt for the crawlers you want, which can happen with rules that block all .txt files or everything outside a few folders. WordPress SEO plugins often generate robots.txt, so check it in the plugin settings as well as at the live URL.

Check your WordPress llms.txt

The llms.txt Auditor fetches your /llms.txt and /llms-full.txt files, validates them against the proposed format, checks that each linked URL responds, confirms robots.txt allows the relevant AI crawlers and scores the quality of the content.

Open llms.txt Fixes โ†’
๐Ÿ’ฌ Got a problem?
Related Guides: All llms.txt Fixes  ·  Fixing a Missing llms.txt  ·  WordPress Agent Readiness  ·  Setting Up llms.txt in Shopify  ·  Learning Hub

About aiwebpageseo

aiwebpageseo.com is a data-driven SEO and AEO (Answer Engine Optimisation) platform providing a free suite of technical SEO tools. Rather than relying on AI-theorised assumptions, the platform analyses live URL performance, delivering objective diagnostics, page speed metrics, CLS debugging, and site crawl data alongside actionable technical tutorials.