·9 min read

How to Add llms.txt to WordPress (Yoast, Rank Math, Plugins)

Adding llms.txt to WordPress

WordPress runs about 38.5% of all websites (W3Techs, November 2026), and most of the big SEO plugins now include an llms.txt option. If you want to add an llms.txt file to a WordPress site, you have four routes: a dedicated plugin, the built-in option in the SEO plugin or page builder you already use, a manual upload, or custom PHP.

This guide covers each one with the current menu paths, and helps you pick.

Why Add llms.txt to a WordPress Site?

An llms.txt file gives AI assistants and coding agents a clean Markdown map of your most useful pages. An agent that fetches it gets a plain list of your key pages, each with a short description, so it doesn't have to dig through your theme, menus, and scripts to find them. That's most useful for sites people work with through AI tools: documentation, product and API sites, and knowledge bases.

It isn't a ranking tool. OpenAI's and Perplexity's crawler documentation mention only robots.txt, and Google says you don't need new machine-readable or AI text files to appear in its AI features. Add llms.txt to help assistants and agents use your content. For the evidence on both sides, see whether llms.txt is still worth it.

Method 1: Use a Dedicated Plugin (Easiest)

A dedicated plugin builds the file from your posts and pages and keeps it updated as you publish. No code required.

Website LLMs.txt

Website LLMs.txt by Ryan Howard has 50,000+ active installations.

Installation steps:

  1. In your WordPress admin, go to Plugins → Add Plugin
  2. Search for "Website LLMs.txt"
  3. Click Install Now, then Activate
  4. Optional: adjust settings under Tools → Llms.txt (the defaults work)

Once activated, it generates llms.txt at your domain root. The current version (8.6.x) generates llms.txt only. If you want an llms-full.txt too, see the free alternative below.

What it does:

  • Builds the file automatically and updates it on publish, daily, or weekly, with a Generate Now button for manual runs
  • Reads your SEO plugin's settings (Yoast, Rank Math, All in One SEO, SEOPress, Slim SEO) and leaves out noindex and nofollow content
  • Lets you choose which post types to include, and add individual restricted posts back from the post editor
  • Serves the file through a rewrite rule when your site root isn't writable, as on WordPress VIP
  • Free, with an opt-in connection to a third-party "Visibility Kit" service

Pros: no code, keeps itself current, free.

Cons: the file follows the plugin's structure, and it's one more plugin. Its "Tested up to" version (WordPress 6.9) lags current WordPress (7.1), so try it on a staging site first.

Free Alternative That Also Makes llms-full.txt

LLMs.txt and LLMs-Full.txt Generator (5,000+ installs) generates both files for free. Elementor's Agent Ready feature does too (see Method 2).

To check either plugin, visit yoursite.com/llms.txt in your browser. You should see a plain-text file listing your content.

Method 2: Use Your SEO Plugin or Page Builder

If you already run one of these, you may not need another plugin.

Yoast SEO (free)

Yoast SEO added llms.txt in version 25.3 (June 2025), in both the free and premium versions.

  1. Go to Yoast SEO → Settings → Site features
  2. Under AI tools, switch on llms.txt
  3. Click Save changes

Yoast regenerates the file weekly, and keeps it small by design. Its documentation says it includes "the 5 latest updated posts/pages/custom post types", with cornerstone content first and posts only if they were published in the last 12 months, plus the five categories and tags with the most content attached. Since version 25.6 you can pick the pages yourself instead. It doesn't generate llms-full.txt, isn't available on multisite, and won't overwrite an llms.txt file that already exists. For what goes in the file and what it leaves out, see Is Yoast's llms.txt Enough?

All in One SEO (AIOSEO)

All in One SEO includes llms.txt in its free Lite version (since 4.8.4, June 2025), switched on by default.

  1. Go to All in One SEO → Sitemaps
  2. Open the LLMs.txt tab
  3. Review the settings and save

llms-full.txt and Markdown versions of your pages are AIOSEO Pro features (added in 4.8.8, October 2025).

Rank Math (free)

Rank Math added llms.txt to its free plugin in version 1.0.250 (July 2025).

  1. Go to Rank Math SEO → Dashboard and enable the LLMS Txt module
  2. Go to General Settings → Edit llms.txt
  3. Choose the post types and taxonomies to include, set a limit (100 by default), and add any extra content

Rank Math leaves out noindex posts. Its documentation doesn't mention llms-full.txt.

SEOPress PRO

SEOPress PRO 9.8 added an Agent Readiness toggle on the SEOPress dashboard that generates llms.txt and works with multilingual plugins (WPML, Polylang, TranslatePress). It isn't in the free version.

Elementor (free)

Elementor 4.4 (November 2026) added Agent Ready, which generates llms.txt, llms-full.txt, and Markdown versions of your pages.

  1. Go to Elementor → Agent Ready → Agent Access
  2. Switch on llms.txt

If an llms.txt file already exists, Elementor leaves it alone unless you choose Take over llms.txt. If you edit the generated file by hand, automatic updates stop.

Pros and Cons of Built-in Options

Pros: nothing new to install, and the settings live with the rest of your SEO setup.

Cons: each tool sets the file's structure, and how much you can choose varies. Of these, only Elementor documents free llms-full.txt support.

Hosted on Hostinger?

The Hostinger Tools plugin has generated llms.txt by default on new sites since version 3.0.79 (October 2026). Check yoursite.com/llms.txt before you add anything else.

Use Only One Generator

Every llms.txt tool claims the same /llms.txt URL, and only one can serve it. Yoast and Elementor leave an existing file in place rather than replace it, and before Website LLMs.txt 8.6.4, running it next to another llms.txt plugin could crash the site. Pick one tool, switch off the llms.txt option in the others, and delete any file you uploaded by hand.

Method 3: Manual Upload via FTP or cPanel (Most Control)

If you want complete control over your llms.txt file's content and structure, manually creating and uploading it is your best bet. This method is perfect if you want to customize exactly what appears in your file.

Step 1: Create Your llms.txt File

First, you need to create the actual file. You can do this in two ways:

Option A: Use our generator

The fastest way is to use our free generator. Other free generators are listed in Best llms.txt Generators, Tested, along with the docs platforms and plugins that publish the file for you.

Enter your WordPress site's URL and the generator crawls it and builds a properly formatted llms.txt you can download (or llms-full.txt, or both).

Option B: Create it manually

Open a plain text editor (Notepad on Windows, TextEdit on Mac in plain text mode, or any code editor) and create your file following the llms.txt format:

markdown
# Your WordPress Site Name

> Brief description of what your site is about

## Blog Posts
- [Post Title 1](https://yoursite.com/post-1): Brief description
- [Post Title 2](https://yoursite.com/post-2): Brief description

## Pages
- [About](https://yoursite.com/about): Information about your site
- [Contact](https://yoursite.com/contact): How to reach you

## Resources
- [Documentation](https://yoursite.com/docs): Helpful guides and tutorials

Save this as llms.txt (not llms.txt.txt – make sure file extensions are visible).

Step 2: Upload the File

Via FTP:

  1. Connect to your site using an FTP client like FileZilla
  2. Navigate to your WordPress root directory (usually public_html or www)
  3. Upload your llms.txt file to this root directory
  4. Set file permissions to 644 if needed

Via cPanel File Manager:

  1. Log in to your hosting cPanel
  2. Open File Manager
  3. Navigate to your WordPress root directory (usually public_html)
  4. Click Upload and select your llms.txt file
  5. Wait for the upload to complete

Step 3: Verify It Works

Visit yoursite.com/llms.txt in your browser. You should see your file displayed as plain text.

Pros:

  • Complete control over content and structure
  • No plugins needed
  • Lightweight approach
  • Can include exactly what you want

Cons:

  • Requires manual updates when content changes
  • Need FTP or cPanel access
  • More technical than plugin methods
  • Must understand the llms.txt format
  • Blocks Yoast's generator while the file exists

Method 4: Custom Code Implementation (For Developers)

If you're comfortable with PHP and want programmatic control over your llms.txt file, you can add custom code to your WordPress theme. This method is ideal for developers who want to dynamically generate the file based on their WordPress content.

Adding Code to functions.php

Add this code to your theme's functions.php file, below its existing opening <?php tag, or put it in a small custom plugin (a plugin file does need its own opening <?php tag). Don't paste a second <?php tag into functions.php: that causes a parse error.

php
// Add rewrite rule for llms.txt
function add_llms_txt_rewrite() {
    add_rewrite_rule('^llms\.txt$', 'index.php?llms_txt=1', 'top');
    add_rewrite_tag('%llms_txt%', '([^&]+)');
}
add_action('init', 'add_llms_txt_rewrite');

// Generate llms.txt content
function generate_llms_txt() {
    if (get_query_var('llms_txt')) {
        header('Content-Type: text/plain; charset=utf-8');
        
        $site_name = get_bloginfo('name');
        $site_description = get_bloginfo('description');
        $site_url = get_site_url();
        
        // Start output
        echo "# {$site_name}\n\n";
        echo "> {$site_description}\n\n";
        
        // Get recent posts
        $posts = get_posts(array(
            'numberposts' => 20,
            'post_status' => 'publish',
            'orderby' => 'date',
            'order' => 'DESC'
        ));
        
        if (!empty($posts)) {
            echo "## Blog Posts\n";
            foreach ($posts as $post) {
                $title = wp_strip_all_tags($post->post_title);
                $url = get_permalink($post->ID);
                $excerpt = wp_trim_words($post->post_excerpt ?: $post->post_content, 15);
                echo "- [{$title}]({$url}): {$excerpt}\n";
            }
            echo "\n";
        }
        
        // Get pages
        $pages = get_pages(array(
            'sort_column' => 'menu_order',
            'post_status' => 'publish'
        ));
        
        if (!empty($pages)) {
            echo "## Pages\n";
            foreach ($pages as $page) {
                $title = wp_strip_all_tags($page->post_title);
                $url = get_permalink($page->ID);
                $excerpt = wp_trim_words($page->post_excerpt ?: $page->post_content, 15);
                echo "- [{$title}]({$url}): {$excerpt}\n";
            }
        }
        
        exit;
    }
}
add_action('template_redirect', 'generate_llms_txt');

// Prevent WordPress from redirecting /llms.txt to /llms.txt/
function prevent_llms_txt_redirect($redirect_url, $requested_url) {
    if (strpos(strtolower((string) parse_url($redirect_url, PHP_URL_PATH)), 'llms.txt') !== false) {
        return false;
    }
    return $redirect_url;
}
add_filter('redirect_canonical', 'prevent_llms_txt_redirect', 10, 2);

Important: Flush Rewrite Rules

After adding this code, you must flush your rewrite rules.

  1. Go to Settings → Permalinks in your WordPress dashboard
  2. Opening the screen is enough: WordPress flushes the rules when it loads. Clicking Save Changes without changing anything works too.

Choosing the Right Method for Your WordPress Site

Here's a quick decision guide to help you pick the best method.

Choose Method 1 (Plugin) if:

  • You want the quickest setup
  • You're not comfortable with code
  • You want automatic updates
  • You want llms-full.txt for free (use the LLMs.txt and LLMs-Full.txt Generator)

Choose Method 2 (SEO Plugin or Page Builder) if:

  • You already use Yoast, Rank Math, AIOSEO, SEOPress PRO, or Elementor
  • You want minimal plugin overhead
  • You're happy with automated content selection

Choose Method 3 (Manual Upload) if:

  • You want complete control over content
  • You have FTP or cPanel access
  • Your site content doesn't change often
  • You want the lightest-weight solution

Choose Method 4 (Custom Code) if:

  • You're a developer or comfortable with PHP
  • You need dynamic content generation
  • You want to integrate with custom post types
  • You need advanced filtering or logic

Testing Your Implementation

Regardless of which method you choose, testing is crucial. Here's how to verify everything works correctly.

1. Basic Access Test

Visit yoursite.com/llms.txt in your browser. You should see:

  • Plain text format (not HTML)
  • Your site name as the H1 heading
  • Properly formatted markdown
  • Working links to your content

2. Format Validation

Use our llms.txt validator to check your file's structure and ensure it follows the standard correctly.

3. Content Accuracy

Review the content to make sure:

  • All links work correctly
  • Descriptions are accurate
  • Important pages aren't missing
  • You haven't accidentally included draft or private content

4. Header Check

Use curl or your browser's developer tools to check the content type.

bash
curl -I https://yoursite.com/llms.txt

You want text/plain. Method 4's code sends text/plain; charset=utf-8; a static .txt file, such as one you upload by hand, is often served as text/plain with no charset. That's usually fine, but if non-English characters display wrongly, ask your host to serve .txt files as UTF-8.

5. AI System Test

Last, try the file with an AI assistant.

  1. Paste or upload your llms.txt into Claude or ChatGPT
  2. Ask questions about your site
  3. Check that it understands your content structure
  4. Check that your important pages are in there

Advanced Tips for WordPress Users

Once you have the basics working, consider adding these improvements.

1. Include Custom Post Types

If you use custom post types (like portfolios, products, or testimonials), make sure they're included in your llms.txt. Plugin users should check plugin settings; custom code users can modify their query:

php
$args = array(
    'post_type' => array('post', 'page', 'portfolio', 'product'),
    'post_status' => 'publish',
    'posts_per_page' => -1
);

2. Organize by Category

For blogs with diverse content, organizing by category can help AI systems understand your site structure better:

markdown
## Marketing Guides
- [SEO Basics](https://yoursite.com/seo-basics): Complete SEO guide for beginners
- [Content Strategy](https://yoursite.com/content-strategy): How to plan your content

## Development Tutorials
- [WordPress Basics](https://yoursite.com/wp-basics): Getting started with WordPress
- [Theme Development](https://yoursite.com/theme-dev): Build custom WordPress themes

3. Respect User Privacy

Make sure not to include:

  • Membership or login-protected content URLs
  • Draft or private pages
  • Author or user profile pages (unless public-facing)
  • Any sensitive information

4. Add llms-full.txt Too

Consider adding the full-content version alongside your standard file. Elementor and the LLMs.txt and LLMs-Full.txt Generator plugin make it for free; in AIOSEO it's a Pro feature. Without a plugin, our free generator can build one from your URL, or you can follow our guide to creating llms.txt and llms-full.txt.

Conclusion

Any of the four methods gets llms.txt onto a WordPress site in a few minutes. If you already use Yoast, Rank Math, AIOSEO, or Elementor, switch on its built-in option first. If you don't, or you want more say over what goes in, install Website LLMs.txt. Upload a file by hand or write PHP when you need exact control over the content.

Whichever you choose, run only one generator, check the result in the llms.txt validator, and look at the file again after big content changes.

For the manual route, our free generator builds a properly formatted llms.txt from your URL in seconds.

Running a Shopify store as well? Shopify already serves an llms.txt for every store. Our guide to adding llms.txt to Shopify shows what's in it and how to edit it.

For general llms.txt questions, see the FAQ, or get in touch.

Share this article