How to Add llms.txt in WordPress (Plugin, PHP & Template)

Learn how to add llms.txt in WordPress using Rank Math, Yoast, or a lightweight PHP snippet. Includes a free copy-and-paste llms.txt template for AI search.

How to Add llms.txt in WordPress (Complete Guide with Plugin, PHP & Template)

Large language models like ChatGPT, Claude, and Perplexity read websites differently than traditional search engine crawlers. When an AI system scans a standard webpage, it often gets bogged down by navigation menus, sidebar widgets, popups, and heavy HTML scripts before it ever reaches your core message.

Adding an llms.txt file solves that bottleneck. Knowing how to add llms.txt in WordPress gives AI crawlers a clean, structured roadmap to your most valuable guides, service pages, and brand details—without forcing them to parse cluttered code.

In this guide, you will learn three reliable ways to set up llms.txt on your WordPress website: using an SEO plugin, adding a lightweight PHP snippet without bloat, or uploading the file directly through your hosting panel. You will also get a ready-to-use Markdown template you can customize in under five minutes.

What Is llms.txt in WordPress (And Why Does It Matter)?       

An llms.txt file is a plain-text Markdown file placed in the root directory of your domain (for example, [https://aroushtechbd.net/llms.txt](https://aroushtechbd.net/llms.txt)). Proposed by Jeremy Howard of Answer.AI, this standard acts as a curated directory built specifically for AI assistants and generative search engines.

If you are already familiar with the foundations of search engine optimization, think of the difference between your standard technical files this way:

  • robots.txt tells search bots which folders they are allowed or blocked from crawling.
  • sitemap.xml lists every indexable URL on your website in XML tags.
  • llms.txt highlights only your highest-value content in clean Markdown, complete with brief context descriptions so AI models understand what each page actually covers.

While Google and AI platforms have not made llms.txt a strict ranking requirement, publishing one removes friction for AI retrieval systems. When someone asks an AI tool for recommendations or tutorials in your niche, a clear llms.txt file makes it far easier for those models to pull accurate facts and cite your URLs properly.

Free llms.txt Template (Copy-Paste Markdown Format)

Before choosing an installation method, prepare your file content. An effective llms.txt follows a strict Markdown hierarchy: an H1 title for your brand, a blockquote summary explaining who you are, and H2 sections grouping your best links with short descriptions.
Below is a working example modeled on our own site structure at Aroush Tech BD. Copy the template and replace the URLs and descriptions with your own website’s pages:
Markdown

# Aroush Tech BD

> Practical SEO learning hub providing step-by-step tutorials on beginner search engine optimization, technical WordPress SEO, backlink building, and Generative Engine Optimization (GEO).

## Core Guides & Tutorials

– [SEO for Beginners: Complete Step-by-Step Guide](https://aroushtechbd.net/seo-for-beginners/): Practical walkthrough covering keyword research, on-page optimization, and sustainable Google ranking fundamentals.

– [Technical SEO & WordPress Optimization](https://aroushtechbd.net/technical-seo-guide/): Actionable checklist for fixing indexing issues, Core Web Vitals, and site architecture.

– [How to Add llms.txt in WordPress](https://aroushtechbd.net/add-llms-txt-wordpress/): Complete tutorial with plugin, PHP snippet, and cPanel methods for AI search visibility.

## Key Services & Resources

– [SEO Audit & Consultation](https://aroushtechbd.net/contact/): Request a technical SEO and AI search visibility review for your website.

– [SEO Blog & Tutorials](https://aroushtechbd.net/blog/): Latest articles covering modern Google updates, AEO, and ethical link building.

## Company & Editorial Standards

– [About Aroush Tech BD](https://aroushtechbd.net/about/): Background on our practical SEO methodology, editorial standards, and learning mission.

– [Contact Us](https://aroushtechbd.net/contact/): Direct ways to reach our team for support or SEO inquiries.

Formatting tips to keep in mind:

•           Be selective: Do not dump 500 blog posts into this file. Stick to 10–25 cornerstone pages that best represent your expertise.

•           Keep descriptions factual: Write concise summaries next to each link rather than sales hype. AI models extract factual context much more reliably than marketing slogans.

Need Help Optimizing Your Site for Google & AI Search?

Not sure if your WordPress structure, schema, or llms.txt setup is holding back your rankings? Request a personalized SEO Audit and get an actionable roadmap tailored to your website.

Method 1: How to Add llms.txt in WordPress Using a Plugin

If you already run a major SEO plugin, check its built-in features first. Keeping everything inside one dashboard avoids unnecessary code edits.

Using Rank Math SEO

Rank Math includes native llms.txt support inside its module manager:

  1. Log in to your WordPress dashboard and go to Rank Math SEO > Dashboard.
  2. Scroll through the modules list, locate LLMS Txt, and toggle the switch On.
  3. Click Settings on that module card (or go to Rank Math SEO > General Settings > Edit llms.txt).
  4. Choose which post types, categories, or custom URLs you want included, or paste your custom Markdown structure directly into the editor.
  5. Click Save Changes.

Example:

# Aroushtechbd

> Aroushtechbd is a digital marketing and search engine optimization resource offering step-by-step tutorials on technical SEO, on-page optimization, off-page link building, and WordPress performance.

## Core SEO Guides

– [Technical SEO](https://aroushtechbd.net/technical-seo/): Comprehensive guides on site architecture, crawling, indexing, sitemaps, and Core Web Vitals.

– [On-Page SEO](https://aroushtechbd.net/on-page-seo/): Actionable tutorials for keyword optimization, content structuring, internal linking, and schema markup.

– [Off-Page SEO](https://aroushtechbd.net/off-page-seo/): Strategies for link building, digital PR, brand mentions, and domain authority growth.

## Key Resources

– [XML Sitemap](https://aroushtechbd.net/sitemap_index.xml): Complete index of all published tutorials and pages.

– [Contact](https://aroushtechbd.net/contact/): Get in touch with Aroushtechbd.

Using Yoast SEO or All in One SEO (AIOSEO)

Both Yoast SEO and AIOSEO have rolled out AI optimization settings that generate an llms.txt endpoint automatically:

  • In Yoast SEO: Navigate to Yoast SEO > Settings > General > Site features, scroll down to the AI features / llms.txt toggle, enable it, and save your settings.
  • In AIOSEO: Open All in One SEO > Search Appearance > Advanced (or General Settings > Webmaster Tools depending on your version), enable the llms.txt generator, and customize which post types appear.

Note: If your SEO plugin’s free tier restricts manual editing of the output, use Method 2 below so you have full control over every line and description.

Method 2: How to Add llms.txt in WordPress Without a Plugin (PHP Snippet)

If you want complete control over your Markdown formatting without installing another dedicated plugin, you can serve a virtual /llms.txt file directly through WordPress using a small PHP snippet.

Instead of editing your theme’s functions.php file—which gets overwritten whenever you update your theme—add this code using a lightweight snippet manager like WPCode or a custom site-specific plugin (replace the example URLs below with your own pages):

PHP

<?php

/**

 * Serve a clean, custom /llms.txt file in WordPress

 * Example configured for https://aroushtechbd.net/

 */

add_action( ‘init’, function() {

    $request_uri = strtok( $_SERVER[‘REQUEST_URI’], ‘?’ );

    if ( ‘/llms.txt’ === $request_uri ) {

        header( ‘Content-Type: text/plain; charset=utf-8’ );

        header( ‘X-Robots-Tag: noindex’ );

        $content = <<<EOT

# Aroush Tech BD

> Practical SEO learning hub providing step-by-step tutorials on beginner search engine optimization, technical WordPress SEO, backlink building, and Generative Engine Optimization (GEO).

## Cornerstone Tutorials

– [SEO for Beginners](https://aroushtechbd.net/seo-for-beginners/): Step-by-step guide covering keyword research, on-page SEO, and Google ranking fundamentals.

– [Technical SEO Checklist](https://aroushtechbd.net/technical-seo-guide/): Practical workflow for improving crawlability, indexing, and site speed.

## About & Contact

– [About Aroush Tech BD](https://aroushtechbd.net/about/): Credentials, mission, and editorial standards.

– [Contact Us](https://aroushtechbd.net/contact/): Get in touch for SEO audits or inquiries.

EOT;

        echo trim( $content );

        exit;

    }

}, 1 );

How to Activate This Snippet Safely:

  1. Go to Code Snippets > + Add Snippet in your WordPress dashboard (using WPCode or your preferred snippet plugin).
  2. Select Add Your Custom Code (New Snippet) and set the Code Type to PHP Snippet.
  3. Paste the code above, customize the site title, URLs, and descriptions to match your website, and set the location to Run Everywhere.
  4. Switch the status from Inactive to Active and click Save Snippet.

Because this runs on the init hook with exit;, WordPress serves plain text immediately without loading heavy theme templates or database queries.

Method 3: Upload llms.txt Manually via cPanel File Manager

If you prefer a static file that never touches PHP or WordPress hooks, uploading a physical .txt file to your server’s root folder is the fastest option.

  1. Open Notepad (Windows) or TextEdit in plain-text mode (Mac).
  2. Paste your customized Markdown template and save the file as llms.txt (make sure it is not saved as llms.txt.txt).
  3. Log in to your hosting cPanel and open File Manager.
  4. Navigate to your website’s root directory—usually public_html (or the specific folder assigned to your domain).
  5. Click Upload in the top toolbar and select your llms.txt file.

Once uploaded, your server will serve the static file directly whenever an AI bot or visitor requests [https://aroushtechbd.net/llms.txt](https://aroushtechbd.net/llms.txt) (or your own domain URL).

How to Test and Verify Your WordPress llms.txt File

After setting up your file using any of the three methods above, run a quick verification check so caching plugins do not hide your work:

  1. Purge your WordPress and server cache: If you use LiteSpeed Cache, WP Rocket, or Cloudflare, click Purge All so your site serves the new URL immediately.
  2. Open the live URL in an Incognito window: Visit [https://yourwebsite.com/llms.txt](https://yourwebsite.com/llms.txt). You should see clean plain text starting with your # Brand Name heading—not a 404 error page or HTML code.
  3. Verify the Content-Type header: Right-click on the live llms.txt page in Chrome, click Inspect > Network, refresh the page, and click on llms.txt. Confirm that the Status Code is 200 and Content-Type reads text/plain; charset=utf-8.

Common Mistakes to Avoid

  • Blocking AI bots in robots.txt: Your llms.txt file will not help if your robots.txt explicitly blocks user agents like OAI-SearchBot, ClaudeBot, or PerplexityBot. Check your robots.txt rules if you want visibility in AI search answers.
  • Stuffing keywords into descriptions: Write natural, descriptive sentences next to your links. Keyword-stuffed lists confuse language models and reduce the accuracy of how your brand gets summarized.
  • Forgetting to update cornerstone links: Whenever you publish a major new guide—such as a step-by-step on-page SEO checklist—or update a core service URL, take two minutes to add it to your llms.txt file so AI crawlers always see your freshest work.

Frequently Asked Questions

Does llms.txt replace sitemap.xml or robots.txt?

No. Keep both your sitemap.xml and robots.txt active as usual. Traditional search engines like Google and Bing still rely on XML sitemaps for crawling and indexing, while llms.txt acts as an additional, AI-friendly summary layer.

Can llms.txt hurt my traditional Google SEO rankings?

No. Search engines treat /llms.txt as a standard plain-text file, and adding an X-Robots-Tag: noindex header (included in the PHP snippet above) ensures Google will not display the raw text file in regular search results instead of your actual webpages.

How often should I update my WordPress llms.txt file?

Review it once every quarter or whenever you launch a new pillar guide, major tool, or core service page. Because it only highlights your best pages rather than every daily blog post, maintenance takes very little time.

Leave a Comment

Your email address will not be published. Required fields are marked *