PHPackages                             roots/acorn-llms-txt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. roots/acorn-llms-txt

ActivePackage[API Development](/categories/api)

roots/acorn-llms-txt
====================

Expose WordPress content through /llms.txt endpoints

v1.0.0-beta.1(9mo ago)131972[1 PRs](https://github.com/roots/acorn-llms-txt/pulls)MITPHPPHP ^8.2CI failing

Since Aug 5Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/roots/acorn-llms-txt)[ Packagist](https://packagist.org/packages/roots/acorn-llms-txt)[ GitHub Sponsors](https://github.com/roots)[ RSS](/packages/roots-acorn-llms-txt/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Acorn LLMs.txt
==============

[](#acorn-llmstxt)

[![Packagist Downloads](https://camo.githubusercontent.com/d5c4257415eec9dfe6b202d821ab52f468ede57e7a17ee7914579cc64fea9a3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6f74732f61636f726e2d6c6c6d732d7478743f6c6162656c3d646f776e6c6f61647326636f6c6f72423d32623330373226636f6c6f72413d353235646463267374796c653d666c61742d737175617265)](https://packagist.org/packages/roots/acorn-llms-txt)[![Build Status](https://camo.githubusercontent.com/5e5cab1714f15f3eca4b81e6f1b51222d671ddf0b4fe60bf7c716713aabd55bd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f6f74732f61636f726e2d6c6c6d732d7478742f6d61696e2e796d6c3f6272616e63683d6d61696e266c6f676f3d676974687562266c6162656c3d4349267374796c653d666c61742d737175617265)](https://github.com/roots/acorn-llms-txt/actions/workflows/main.yml)[![Follow Roots](https://camo.githubusercontent.com/222256dbdeac58e77f017d847dca30ff4cab027cdf3abfec8e5bfd59de240547/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666f6c6c6f7725323040726f6f747377702d3164613166323f6c6f676f3d74776974746572266c6f676f436f6c6f723d666666666666266d6573736167653d267374796c653d666c61742d737175617265)](https://twitter.com/rootswp)[![Sponsor Roots](https://camo.githubusercontent.com/31e13361135ff96d01f1eb97157d052029e6f236249996072d8b6bd60b40e9cd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73706f6e736f72253230726f6f74732d3532356464633f6c6f676f3d676974687562267374796c653d666c61742d737175617265266c6f676f436f6c6f723d666666666666266d6573736167653d)](https://github.com/sponsors/roots)

Expose your WordPress site content through `/llms.txt` endpoints following the [llmstxt.org specification](https://llmstxt.org/). This makes your WordPress content easily accessible to Large Language Models (LLMs) in a structured, markdown format.

Support us
----------

[](#support-us)

Roots is an independent open source org, supported only by developers like you. Your sponsorship funds [WP Packages](https://wp-packages.org/) and the entire Roots ecosystem, and keeps them independent. Support us by purchasing [Radicle](https://roots.io/radicle/) or [sponsoring us on GitHub](https://github.com/sponsors/roots) — sponsors get access to our private Discord.

Features
--------

[](#features)

- **llmstxt.org compliant**: Implements the standard specification for LLM-readable content
- **Multiple endpoints**: `/llms.txt` (listing), `/llms-full.txt` (complete content), `/llms-small.txt` (excerpts), individual post endpoints
- **XML sitemap integration**: `/llms-sitemap.xml` with automatic SEO plugin integration (Yoast, RankMath, The SEO Framework, WordPress core)
- **SEO integration**: Respects noindex settings and adds X-Robots-Tag headers to prevent search engine indexing
- **WooCommerce support**: Product SKUs, prices, and metadata automatically included
- **Hierarchical pages**: Displays page hierarchy with proper indentation
- **High performance**: Built-in Laravel Cache integration with automatic invalidation
- **WordPress shortcode processing**: Converts shortcodes to readable content before markdown conversion
- **Extensible**: Developer hooks and filters for customization
- **Configurable**: Comprehensive configuration options for content filtering and formatting

Installation
------------

[](#installation)

Install via Composer:

```
composer require roots/acorn-llms-txt
```

Publish the configuration file:

```
wp acorn vendor:publish --provider="Roots\AcornLlmsTxt\Providers\LlmsTxtServiceProvider"
```

Endpoints
---------

[](#endpoints)

### `/llms.txt`

[](#llmstxt)

A structured listing of your site content (like a table of contents):

```
# Your Site Name

> Your site tagline or description (if available)

## Additional Resources

- [Full Content](https://yoursite.com/llms-full.txt) - Complete content of all posts and pages in Markdown format

## Recent Posts

- [Hello World (Post | Category: Uncategorized)](https://yoursite.com/hello-world/) - Welcome to WordPress. This is your first post.

## Pages

- [About (Page)](https://yoursite.com/about/) - Information about your site
  - [Contact (Page)](https://yoursite.com/about/contact/) - Get in touch with us

```

### `/llms-full.txt`

[](#llms-fulltxt)

Complete content of all posts and pages in markdown format:

```
# Your Site Name

---

## Hello World
URL: https://yoursite.com/hello-world/
Date: 2025-01-01
Author: Admin
Type: Post
Category: Uncategorized

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

```

### `/llms-small.txt`

[](#llms-smalltxt)

Compressed version with excerpts only for faster processing:

```
# Your Site Name (Excerpts)

## Hello World (Post | Category: Uncategorized)
URL: https://yoursite.com/hello-world/
Date: 2025-01-01
Author: Admin

Welcome to WordPress. This is your first post...

```

### `/llms-sitemap.xml`

[](#llms-sitemapxml)

XML sitemap listing all llms.txt endpoints, automatically integrated with SEO plugins.

### Individual Post Endpoints (Optional)

[](#individual-post-endpoints-optional)

Access individual posts via `/post-slug.txt` (disabled by default for performance).

Configuration
-------------

[](#configuration)

After publishing, edit `config/llms-txt.php`:

### Post Types

[](#post-types)

```
'post_types' => ['post', 'page'],
```

### Content Processing

[](#content-processing)

```
'content' => [
    'process_shortcodes' => true, // Process WordPress shortcodes
    'include_featured_image' => false,
    'include_author' => true,
    'include_date' => true,
    'include_taxonomies' => true,
    'excerpt_length' => 20,
    'date_format' => 'Y-m-d',
],
```

### Content Limits

[](#content-limits)

```
'limits' => [
    'max_posts' => 1000,
    'max_content_length' => 50000,
    'posts_per_section' => 50,
],
```

### Exclusions

[](#exclusions)

```
'exclude' => [
    'post_ids' => [123, 456], // Specific posts to exclude
    'password_protected' => true,
    'sticky_posts' => false,
],
```

### Individual Post Endpoints

[](#individual-post-endpoints)

```
'individual_posts' => [
    'enabled' => false, // Enable /post-slug.txt endpoints
    'post_types' => ['post', 'page'],
    'cache_ttl' => 3600,
],
```

### Caching

[](#caching)

```
'cache_ttl' => 3600, // 1 hour in seconds
```

### WooCommerce Integration

[](#woocommerce-integration)

```
'woocommerce' => [
    'enabled' => true, // Enable WooCommerce integration
    'include_price' => true, // Include product price
    'include_stock_status' => false, // Include stock status
    'include_product_type' => false, // Include product type
],
```

SEO Integration
---------------

[](#seo-integration)

The package automatically respects SEO plugin settings and integrates with their sitemaps:

**Content Filtering:**

- **Yoast SEO**: Excludes posts/pages with noindex meta
- **RankMath**: Excludes posts/pages with noindex settings
- **The SEO Framework**: Excludes posts/pages marked as noindex

**Sitemap Integration:**

- **Yoast SEO**: Adds `/llms-sitemap.xml` to main sitemap index
- **RankMath**: Registers llms sitemap in sitemap array
- **The SEO Framework**: Creates custom sitemap endpoint
- **WordPress Core**: Integrates with wp\_sitemaps system

**Search Engine Protection:**

- Adds `X-Robots-Tag: noindex` header to all llms.txt endpoints to prevent search engine indexing

Posts marked as noindex by SEO plugins will not appear in any llms.txt endpoints.

WP-CLI Commands
---------------

[](#wp-cli-commands)

### View package information

[](#view-package-information)

```
wp acorn llms-txt
```

### Clear cached content

[](#clear-cached-content)

```
wp acorn llms-txt clear-cache
```

Developer Hooks
---------------

[](#developer-hooks)

### Filters

[](#filters)

Filter which post types are included:

```
add_filter('acorn/llms_txt/post_types', function ($postTypes) {
    return array_merge($postTypes, ['custom_post_type']);
});
```

Exclude specific posts:

```
add_filter('acorn/llms_txt/exclude_post', function ($exclude, $post) {
    return $post->post_title === 'Secret Post';
}, 10, 2);
```

Filter individual post data:

```
add_filter('acorn/llms_txt/post_data', function ($data, $post) {
    $data['custom_field'] = get_post_meta($post->ID, 'custom_field', true);
    return $data;
}, 10, 2);
```

Filter the complete posts collection:

```
add_filter('acorn/llms_txt/posts', function ($posts) {
    return $posts->sortBy('title');
});
```

Filter the entire document before output:

```
add_filter('acorn/llms_txt/document', function ($document) {
    // Modify the LlmsTxtDocument object
    return $document;
});
```

Filter final content before serving:

```
add_filter('acorn/llms_txt/content', function ($content) {
    return $content . "\n\n";
});
```

Filter XML sitemap before serving:

```
add_filter('acorn/llms_txt/sitemap', function ($sitemap) {
    // Modify the XML sitemap content
    return $sitemap;
});
```

Control sitemap integration:

```
add_filter('acorn/llms_txt/include_in_sitemaps', function ($include) {
    // Disable sitemap integration conditionally
    return false;
});
```

### Actions

[](#actions)

Add custom sections before default content:

```
add_action('acorn/llms_txt/before_sections', function ($document) {
    $section = (new \Roots\AcornLlmsTxt\Data\Section)
        ->name('Custom Section')
        ->addLink(
            (new \Roots\AcornLlmsTxt\Data\Link)
                ->title('Custom Link')
                ->url('https://example.com')
                ->details('Custom description')
        );

    $document->addSection($section);
});
```

Add custom sections after default content:

```
add_action('acorn/llms_txt/after_sections', function ($document) {
    // Add sections after default content
});
```

Add completely custom sections:

```
add_action('acorn/llms_txt/custom_sections', function ($document) {
    // Add your own sections
});
```

Cache Management
----------------

[](#cache-management)

The package automatically invalidates cache when:

- Posts are created, updated, or deleted
- Post status changes
- Post metadata is updated

Manual cache clearing:

```
wp acorn llms-txt clear-cache
```

Performance
-----------

[](#performance)

This package is optimized for performance with:

- **Efficient caching**: Laravel Cache integration reduces database queries
- **Automatic cache invalidation**: Updates cache only when content changes
- **Memory optimization**: Designed to handle large sites with thousands of posts
- **Configurable limits**: Control content length and post counts to manage resource usage

Troubleshooting
---------------

[](#troubleshooting)

### Cache Issues

[](#cache-issues)

If content isn't updating, clear the cache:

```
wp acorn llms-txt clear-cache
```

### Routes Not Working

[](#routes-not-working)

Ensure Acorn routes are optimized:

```
wp acorn optimize
```

### Performance on Large Sites

[](#performance-on-large-sites)

For sites with many posts, adjust limits in `config/llms-txt.php`:

```
'limits' => [
    'max_posts' => 500,
    'max_content_length' => 25000,
],
```

Requirements
------------

[](#requirements)

- PHP 8.2+
- WordPress with [Acorn](https://roots.io/acorn/)

Community
---------

[](#community)

Keep track of development and community news.

- Join us on Discord by [sponsoring us on GitHub](https://github.com/sponsors/roots)
- Join us on [Roots Discourse](https://discourse.roots.io/)
- Follow [@rootswp on Twitter](https://twitter.com/rootswp)
- Follow the [Roots Blog](https://roots.io/blog/)
- Subscribe to the [Roots Newsletter](https://roots.io/subscribe/)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance75

Regular maintenance activity

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

280d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f3f71fa88954b93f55af5e121f1d8c38d240a0d17712c092a389bcccffa34415?d=identicon)[retlehs](/maintainers/retlehs)

---

Top Contributors

[![retlehs](https://avatars.githubusercontent.com/u/115911?v=4)](https://github.com/retlehs "retlehs (6 commits)")[![digital-brew](https://avatars.githubusercontent.com/u/41974673?v=4)](https://github.com/digital-brew "digital-brew (1 commits)")

---

Tags

acornacorn-packageailaravelllms-txtwordpresswordpress-laravel

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/roots-acorn-llms-txt/health.svg)

```
[![Health](https://phpackages.com/badges/roots-acorn-llms-txt/health.svg)](https://phpackages.com/packages/roots-acorn-llms-txt)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
