How to Add llms.txt to WordPress (3 Methods, Step by Step)

Short answer: add a plain-text file called llms.txt to your WordPress site’s root directory so it loads at yoursite.com/llms.txt. WordPress has no built-in setting for this, so you either upload the file via your host’s file manager or FTP, or serve it with a small snippet in your theme. Both methods take under ten minutes.

This guide covers three ways to do it, how to verify it works, and what to actually put in the file. If you want the file generated for you first, use our free llms.txt generator.

What llms.txt is (and what it is not)

llms.txt is a proposed standard for a markdown file at your domain root that gives AI systems a curated map of your most important content. Think of it as the opposite of robots.txt: robots.txt controls access, llms.txt describes meaning.

Be clear-eyed about its status. No major AI provider has publicly committed to reading llms.txt, and adding one will not by itself get you cited. It costs a few minutes, carries no SEO risk, and signals machine-friendliness — that is the honest case for it. The things that genuinely move AI visibility are covered in our LLM SEO guide.

Method 1: Upload via your host’s file manager (easiest)

This is the method we recommend for most people, because the file is served directly by the web server with no PHP involved.

  1. Generate your file content — the llms.txt generator outputs a valid file you can download.
  2. Log in to your hosting control panel (cPanel, Plesk, SiteGround Site Tools, Hostinger hPanel and so on) and open the File Manager.
  3. Navigate to your site’s root folder — the one containing wp-config.php, wp-content and usually robots.txt. It is typically called public_html, htdocs or www.
  4. Upload your llms.txt file there. Do not put it inside wp-content or your theme folder.
  5. Visit yoursite.com/llms.txt in a browser to confirm it loads.

If you prefer FTP, the process is identical — connect with FileZilla or similar and drop the file in the same root directory.

Method 2: Serve it from your theme with a snippet

If you cannot access the filesystem — some managed hosts restrict it — you can have WordPress serve the file itself. Add this to your child theme’s functions.php or a code-snippets plugin:

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;
    }
    header('Content-Type: text/plain; charset=utf-8');
    echo "# Your Site Name\n\n";
    echo "> One-sentence description of what your site does.\n\n";
    echo "## Key pages\n\n";
    echo "- [LLM SEO Guide](https://example.com/llm-seo): Complete guide to AI search optimization\n";
    exit;
});

After adding the snippet, go to Settings → Permalinks and click Save Changes once. That flushes the rewrite rules so the new URL resolves. Then check yoursite.com/llms.txt.

Edit code on a staging site first if you can, and always use a child theme — a parent theme update will wipe changes made directly to its files.

Method 3: Use a plugin

Several plugins now generate llms.txt automatically from your published content. They are convenient, but they tend to dump every post and page into the file, which defeats the purpose — the value of llms.txt is that it is curated. If you use one, prune the output to the pages that genuinely represent your site.

What to put in the file

Keep it short and high-signal. A good llms.txt has an H1 with your site name, a one-line blockquote description, optionally a short paragraph of context, and a curated list of your most important URLs with brief notes on each.

# Acme Analytics

> Product analytics for small SaaS teams.

Acme Analytics helps product teams track activation and retention
without a data warehouse. Founded 2021, used by 400+ teams.

## Key pages

- [Pricing](https://acme.com/pricing): Plans, limits and free tier
- [Docs](https://acme.com/docs): Setup guides and API reference
- [Comparison](https://acme.com/vs-mixpanel): How we differ from Mixpanel

Ten to thirty links is plenty for most sites. Every URL should be a page you would be happy to have quoted in an AI answer.

How to verify it worked

Load yoursite.com/llms.txt in a private browsing window. You should see plain text, not a 404 page and not your theme’s layout. If the file downloads instead of displaying, the content type is wrong — that is normal for the upload method and harmless.

Common failures: the file was uploaded into a subfolder rather than the root; a caching layer or CDN is still serving a 404, so purge the cache; or on the snippet method, permalinks were not re-saved after adding the code.

The step that actually matters more

While you are in your site’s root directory, open robots.txt and check you are not blocking AI crawlers. Many sites added blanket blocks for GPTBot, ClaudeBot, PerplexityBot and Google-Extended in 2023 and forgot about them. If those crawlers cannot fetch your pages, no llms.txt file will help — this is the single most common self-inflicted AI visibility problem we see.

Once both are sorted, check where you actually stand with our free AI Visibility Checker, or score a specific page with the GEO Audit.

Hassan Zaviar, founder of LLM Optimization

Written by

Hassan Zaviar

Hassan Zaviar is the founder of LLM Optimization, where he researches how AI search engines such as ChatGPT, Google AI Overviews, Perplexity, Gemini and Claude choose the sources they cite. He builds free tools that help marketing and content teams measure their AI visibility and fix what is holding it back.

Scroll to Top