DEV Community

José Manuel Ramírez
José Manuel Ramírez

Posted on

I built a WordPress plugin that generates llms.txt from your sitemap

If you've been following the GEO (Generative Engine Optimization) space, you've probably heard of llms.txt — an emerging standard that tells AI crawlers like ChatGPT, Perplexity and Claude what your site is about and which pages matter.

The problem: there was no decent WordPress solution that generated it automatically. So I built one.

wp-llms-txt reads your existing sitemap and serves a dynamic /llms.txt at your domain. No manual updates. Titles are resolved directly from the WordPress database — zero HTTP requests, instant, accurate.

What the output looks like

# Boneluv

> Agencia digital premium en Sevilla. Diseño web WordPress a medida,
  SEO, hosting BoneCloud y automatización con IA para empresas B2B.

## Páginas

- [Diseño Web a Medida](https://boneluv.com/diseno-web-a-medida/)
- [Posicionamiento SEO](https://boneluv.com/posicionamiento-seo/)
- [Hosting BoneCloud](https://boneluv.com/hosting-bonecloud/)

## Blog

- [Cómo mejorar la velocidad de WordPress](https://boneluv.com/blog/mejorar-velocidad-wordpress/)
Enter fullscreen mode Exit fullscreen mode

Features

  • WordPress plugin — dynamic /llms.txt and /llms-full.txt endpoints with transient caching
  • Standalone PHP CLI — no WordPress required
  • DB-based title resolution — reads directly from WordPress DB via url_to_postid(), zero HTTP requests
  • Sitemap index support — Rank Math, Yoast SEO, The SEO Framework, All in One SEO
  • Auto-sections — groups URLs by sitemap source (page-sitemap.xmlPages, post-sitemap.xmlBlog)
  • Preview & inline editor — view and edit the output directly from WP Admin
  • Spanish translation included (es_ES)
  • Wildcard URL exclusion patterns

DB title resolution — how it works

Instead of making one HTTP request per URL (slow, fragile on large sitemaps), the plugin resolves titles directly from the WordPress database:

// Resolution order:
// 1. Front page
// 2. url_to_postid() → get_the_title()
// 3. Term archives (categories, tags, custom taxonomies)
// 4. Fallback: slug-derived title
Enter fullscreen mode Exit fullscreen mode

This means a sitemap with 300 URLs generates the full llms.txt in milliseconds, with no external requests.

Preview & inline editor

The Settings → LLMs.txt page has two tabs. The second one shows the current output and lets you edit it directly from WP Admin — no file access needed. A Reset to auto-generated button restores automatic generation at any time.

Settings tab with preview and editor

CLI usage

If you want the file without installing a WordPress plugin:

php cli/generate.php \
  --sitemap=https://yoursite.com/sitemap.xml \
  --name="Your Site" \
  --desc="What your site is about." \
  --output=llms.txt
Enter fullscreen mode Exit fullscreen mode

Full options:

--sitemap=URL        Sitemap URL (supports sitemap index files)
--output=FILE        Write to file instead of stdout
--name=STRING        Site name for the # H1 header
--desc=STRING        Description for the > blockquote
--fetch-titles       Fetch real <title> via HTTP (slower)
--exclude=PATTERN    Exclude URLs matching pattern (repeatable)
--max-urls=N         Max URLs to process (default: 500)
Enter fullscreen mode Exit fullscreen mode

Recommended robots.txt additions

User-agent: GPTBot
Allow: /llms.txt

User-agent: PerplexityBot
Allow: /llms.txt

User-agent: ClaudeBot
Allow: /llms.txt

User-agent: Google-Extended
Allow: /llms.txt
Enter fullscreen mode Exit fullscreen mode

Repository

MIT licensed. No telemetry. No upsells.

GitHub logo LBoneLuv / wp-llms-txt

Generate /llms.txt from your sitemap so ChatGPT, Perplexity and Claude understand your site

wp-llms-txt

Generate /llms.txt and /llms-full.txt from your sitemap so AI crawlers understand your site.

PHP 8.0+ WordPress 6.0+ License: MIT Version


What is llms.txt?

llms.txt is an emerging standard (proposed by Answer.AI) that gives AI language models a structured, human-readable map of a website — similar to what robots.txt does for web crawlers and sitemap.xml for search engines.

When ChatGPT, Perplexity, Claude, or Gemini crawl your site, a well-structured llms.txt helps them understand what you do, which pages matter, and how your content is organized. This directly affects how and whether your site gets cited in AI-generated answers.

A typical llms.txt looks like:

# Boneluv

> Agencia digital premium en Sevilla. Diseño web WordPress a medida, WooCommerce, SEO, hosting BoneCloud, Microsoft 365 y automatización con IA para empresas B2B.

## Páginas

- [Diseño Web a Medida](https://boneluv.com/diseno-web-a-medida/)
- [Posicionamiento SEO](https://boneluv.com/posicionamiento-seo/)
- [Hosting BoneCloud](https://boneluv.com/hosting-bonecloud/)

## Blog

- [Cómo mejorar la velocidad de WordPress en 2026](https://boneluv.com/blog/mejorar-velocidad-wordpress/)

Features

  • WordPress

Stars and feedback welcome. If you run into issues with a specific sitemap format, open an issue and I'll look into it.

Top comments (0)