WordPress has three llms.txt paths — plugin, functions.php, or hosted snippet. Plus caching plugin gotchas (W3 Total Cache, WP Rocket) and .htaccess tips.
Open your WordPress admin, click around for ten minutes, and you'll notice something: there is no place to add llms.txt. Not in Settings → General. Not in Yoast SEO. Not in Rank Math. As of mid-2026 the major SEO plugins still don't ship a llms.txt generator — though several have it on the roadmap and the smaller AI-SEO plugins have started filling the gap. That mismatch (43% of the web runs WordPress, and the platform has zero first-class support for the file every AI client wants) is the whole reason this post exists.
This guide covers the three install paths that work on WordPress in 2026: a plugin, a functions.php hand-roll, and a hosted snippet. Plus the WordPress-specific failure modes — caching plugins serving stale files, .htaccess rules intercepting the path, multisite quirks, and the WooCommerce question. If you need a primer on the file format itself, read what llms.txt is and how AI clients use it first.
WordPress feels like it should make this easy — you can write to the file system, you have a templating system, you have plugins for everything. In practice four things go wrong:
/llms.txt through index.php by default. Unless you tell it otherwise, you get a 404 even if the file exists in your webroot.llms.txt can sit stale for a week if you don't exclude the path explicitly.llms.txt produces a file that's both useless to agents (no signal) and over the 30k-token truncation limit.llms.txt size budget if you list everything.Each install path below handles these constraints differently.
Before picking an install path, decide what goes in the file. For a typical WordPress site, the high-value sections are:
The target file size is 30-80KB of markdown. That's roughly 60-150 links with descriptions. If your site has more than that, curate.
The lowest-effort path if a maintained plugin exists for your needs. As of mid-2026 the situation is in flux: the major SEO plugins (Yoast, Rank Math, SEOPress, All in One SEO) have not yet shipped first-class llms.txt generators, though feature requests are open on all four. A handful of smaller AI-focused plugins have filled the gap — search the WordPress plugin directory for "llms.txt" and you'll find them.
What to evaluate when picking a plugin:
/llms.txt with correct content-type. Some plugins serve at /wp-content/llms.txt or /?llms_txt=1, both of which agents don't check./llms.txt, you'll serve stale files. More on this below.The honest framing: as of 2026 the plugin path on WordPress is the most variable. The good plugins work. The mediocre ones produce a file that exists at a URL agents don't check and gets cached for a week. Check reviews, check the changelog, install on staging first.
For a developer-comfortable site without a plugin you trust, write a small handler in functions.php (or a custom plugin file — recommended over editing the theme directly). The pattern: register a URL, intercept the request, fetch the data you want, emit markdown with the right content-type.
Here's a minimum working version. Drop this into a custom plugin file or your theme's functions.php:
<?php
add_action('init', function() {
add_rewrite_rule('^llms\.txt$', 'index.php?llms_txt=1', 'top');
add_rewrite_tag('%llms_txt%', '([0-9]+)');
});
add_action('template_redirect', function() {
if (!get_query_var('llms_txt')) {
return;
}
header('Content-Type: text/markdown; charset=utf-8');
header('Cache-Control: public, max-age=86400');
$site = get_bloginfo('name');
$desc = get_bloginfo('description');
$url = home_url();
echo "# {$site}\n\n";
echo "> {$desc}\n\n";
echo "## About\n";
echo "- [{$site}]({$url}): {$desc}\n\n";
$top_posts = get_posts([
'posts_per_page' => 30,
'orderby' => 'comment_count',
'order' => 'DESC',
'post_status' => 'publish',
]);
echo "## Posts\n";
foreach ($top_posts as $p) {
$excerpt = wp_strip_all_tags(get_the_excerpt($p));
$excerpt = mb_substr($excerpt, 0, 160);
echo "- [{$p->post_title}](" . get_permalink($p) . "): {$excerpt}\n";
}
exit;
});
After installing, visit Settings → Permalinks and click Save — this flushes WordPress's rewrite rules and registers the new /llms.txt route. Then verify with curl -I https://yoursite.com/llms.txt. You should see a 200 and Content-Type: text/markdown; charset=utf-8.
This is the minimum viable version. A production version would: add category sections, include cornerstone pages, exclude noindex posts, cache the output for an hour to avoid hammering the DB on every fetch, and emit llms-full.txt as a companion route.
Downsides: you own the maintenance. Every time you change content strategy you're editing PHP. And if a cache plugin is in front of WordPress, the response gets cached and your regeneration logic doesn't matter.
The third path skips both the plugin and the PHP. Crawlytics crawls your WordPress sitemap (every modern WP install exposes /sitemap_index.xml or /sitemap.xml via Yoast, Rank Math, or core), scores each URL on six signals, and writes llms.txt and llms-full.txt to stable URLs that you point a single redirect at.
The mechanical advantage on WordPress specifically: the files live outside your cache layer entirely. Your WP Rocket, W3 Total Cache, or LiteSpeed Cache plugin can't serve a stale version because they never see the request — the redirect from /llms.txt hits Crawlytics directly. Updates land instantly, you don't have to remember to purge cache, and you don't have to maintain a custom plugin.
The other advantage is per-bot analytics. WordPress hosts (especially managed ones like WP Engine, Kinsta, Pressable) often don't give you raw access log access. So the grep-the-logs playbook doesn't work — you can't see whether GPTBot, ChatGPT-User, ClaudeBot, or PerplexityBot are fetching your file. Crawlytics logs the fetches at the file level and shows them in a dashboard.
This is the failure mode that catches people most often. You install a plugin or write the PHP handler, verify with curl that the file is correct, and then a week later realize the file in production is from last Tuesday. The cause is your cache plugin.
Each major caching plugin needs /llms.txt (and /llms-full.txt) added to its excluded paths list:
/llms.txt and /llms-full.txtyoursite.com/llms.txt with Cache Level: BypassIf you're on Path 3 (hosted snippet) this doesn't apply — the file is served from outside your stack so the cache plugin never sees the request. That's the structural reason the hosted path is the most reliable for heavily-cached WordPress sites.
After install, three checks:
curl -I https://yoursite.com/llms.txt — expect HTTP/2 200 and content-type: text/markdown or text/plain. If you see text/html, your handler isn't setting the header.curl https://yoursite.com/llms.txt | head -20 — expect the H1, blockquote, and first section to render as raw markdown. If you see HTML chrome, your handler isn't exiting before WordPress wraps the theme.curl -s https://yoursite.com/llms.txt | grep -c '^- \[' — counts the number of links. For a working file you'd expect this to be at least 20.For a deeper AI-readiness audit beyond llms.txt, run the free Agent-Ready Grader — it checks robots.txt, sitemap, meta, and llms.txt in one pass.
Does Yoast SEO generate llms.txt automatically? As of mid-2026, no. Yoast generates sitemap.xml and meta tags, but does not ship a first-class llms.txt generator. The same is true of Rank Math, SEOPress, and All in One SEO. Feature requests are open on all four — this may change in late 2026.
Will WP Super Cache serve a stale llms.txt? Yes, unless you exclude the path explicitly. Default cache TTL on most plugins is 24 hours minimum, often a week. Add /llms.txt and /llms-full.txt to the rejected URIs list, or use the hosted-snippet path which sidesteps the cache layer entirely.
Can I add llms.txt without editing functions.php? Yes — install a plugin (Path 1) or use a hosted snippet (Path 3). The functions.php path is for developers who want full control; it's not the only option.
What if I'm on WordPress.com (the hosted plan)? Functions.php editing is locked on most WordPress.com plans below Business. The Business and Commerce plans allow plugins. Below that, your only real option is the hosted snippet — point a custom DNS-level redirect from /llms.txt at the Crawlytics file. Free and Personal plans don't expose enough infrastructure to do this cleanly.
Does llms.txt work with WooCommerce product pages? Yes, but with caveats. WooCommerce adds product, category, attribute, and variant URLs — you do not want all of them in the file. Curate down to top categories (10-20) and best-selling products (30-50). The plugin and hosted-snippet paths both let you control this; the functions.php path requires you to write the WooCommerce query yourself.
Written by Crawlytics Team. Crawlytics tracks AI bots, generates llms.txt, and powers WebMCP commerce, all from one snippet on any stack. See how it works →
This page is part of Crawlytics.app. View all pages: llms.txt · llms-full.txt