llms.txt Directory

llms.txt for WordPress

Add a spec-compliant /llms.txt to any WordPress site. Plugin, wp-content drop-in, or a rewrite rule that generates from your posts.

Why llms.txt on WordPress?

WordPress powers ~43% of the web, so AI systems hit a WordPress site more often than any other stack. A well-structured llms.txt is the fastest way to make your posts, docs, and product pages legible to ChatGPT, Claude, and Perplexity, especially when your theme buries important pages behind archives and taxonomies.

WordPress gives you three clean install paths: upload a static file via SFTP or the file manager, install a plugin that generates it from your post types, or add a tiny snippet that registers /llms.txt as a rewrite and renders on demand. Pick the one that matches how much you want to automate.

Install options

Pick whichever fits your stack. For most teams the module or a static file is enough; reach for the dynamic route when you need request-time content.

Static file

Drop a file at /llms.txt. No build step, no server logic.

```md
# My WordPress Site

> A short summary of what this site covers and who it is for.

## Guides

- [Getting Started](https://example.com/getting-started): Quick setup guide
- [Frequently Asked Questions](https://example.com/faq): Common questions answered

## Products

- [Pricing](https://example.com/pricing): Plans and pricing
- [Features](https://example.com/features): Feature list

```
Dynamic route

Generate at request time from a CMS, MDX collection, or database. Handler at wp-content/mu-plugins/llms-txt.php.

```php
<?php
/**
 * Plugin Name: llms.txt for WordPress
 * Description: Exposes /llms.txt built from published pages.
 */

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

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

add_action('template_redirect', function () {
  if (!get_query_var('llms_txt')) return;

  $site = get_bloginfo('name');
  $desc = get_bloginfo('description');
  $lines = ["# {$site}", '', "> {$desc}", '', '## Pages'];

  $pages = get_posts([
    'post_type' => ['page', 'post'],
    'posts_per_page' => 50,
    'post_status' => 'publish',
  ]);

  foreach ($pages as $p) {
    $url = get_permalink($p);
    $title = get_the_title($p);
    $excerpt = wp_trim_words(strip_tags($p->post_content), 20);
    $lines[] = "- [{$title}]({$url}): {$excerpt}";
  }

  header('Content-Type: text/plain; charset=utf-8');
  header('Cache-Control: public, max-age=3600');
  echo implode("\n", $lines);
  exit;
});

```

Drop this in wp-content/mu-plugins/ (create the folder if needed). The file is auto-loaded; no activation required, and /llms.txt is generated from your published posts and pages.

Serve markdown to agents

Claude Code, Cursor, and Codex increasingly request markdown via the Accept: text/markdown header. Pairing your llms.txt with per-page markdown responses makes your whole site legible to agents, not just the index.

Generate llms.txt from your URL or browse the llms.txt directory for real examples.

Frequently Asked Questions

Upload a hand-written llms.txt to your site root via SFTP or your host's file manager. It lives alongside wp-config.php and is served directly without touching WordPress. This is the right choice for sites that want a fully curated, hand-edited file.

Several plugins exist in the directory. They generate llms.txt from your published posts and pages and re-run on every publish. If you want zero-setup automation, pick one; if you want more control over what is included, use the mu-plugin snippet or upload a static file.

Yes. Drop a tiny PHP snippet into wp-content/mu-plugins/llms-txt.php that registers /llms.txt as a rewrite rule and iterates over your published posts and pages. Must-use plugins auto-load, so there is no activation step.

No. llms.txt is its own file at /llms.txt, separate from your robots.txt and sitemap.xml. SEO plugins do not touch it. Keep all three in sync: robots.txt for crawl access, sitemap.xml for search engines, llms.txt for AI systems.

If you use the rewrite-rule approach, yes — visit Settings → Permalinks once and hit Save to flush the rewrite cache. Static files uploaded to the site root never need a flush.

Related tools