What is llms.txt?

llms.txt is a file that focuses on how AI systems and large language models(LLMs) such as ChatGPT, Claude, Grok, Gemini, and other AI assistants are allowed to use, process or reference your website’s content when it’s accessed.
It is similar to robots.txt file, but it is specifically for AI and LLM based systems and not for search engines.
Why llms.txt is important
The way websites are accessed has been changed now, content now is no longer used for search indexing or human reading. AI systems now use web content to generate answers and recommendations.
Without a clear understanding AI systems might crawl content of the websites without knowing whether it is intended for training or limited reference. This way website owners has no way to communicate their needs with AI systems.
So llms.txt acts as a machine readable system that AI system can check before using your websites content it clearly communicates what content is allowed and whether it can be used for training, accessed only for summaries, or restricted from verbatim reproduction, llms.txt reduces complexity and creates transparent interactions between websites and AI systems.
How llms.txt works
It works by providing AI systems with a clear set of instructions as to how the website’s content is to be used.
1. File Location
When AI systems access a website it checks for the presence of:
/llms.txt
2. Checking usage rules
If the llms.txt file exists on the website, AI systems reads the permission listed in it, such as how the content can be used
These rules describe:
How the content may be used.
Whether it can be used for AI training
Whether it can be summarized
Whether the content can be copied word for word.
These rules help ensure that content is used according to the website owner’s preferences.
3. Understanding the rules
For example:
- If AI training is not allowed
The content must not be included in training datasets or used to improve future AI models. - If AI input is permitted
The content may be read and used for answering questions or generating summaries. - If verbatim usage is restricted
The AI must not reproduce the content word-for-word and should instead paraphrase or summarize.
These instructions define how content may be reused after it is accessed, not whether it can be accessed at all.
4. Example llms.txt
ai_train => no
ai_input => yes
ai_output => limited
In the above code:
ai_input => no
-
AI models cannot use your content to train or improve themselves
-
Your content won’t be stored in training datasets
ai_input => yes
-
AI systems can read your content
-
They can use it for answers, summaries, or understanding context
ai_output => limited
-
AI cannot reproduce your content word-for-word
-
Only summaries, paraphrasing, or brief references are allowed
AI can read your content, but not learn from it or copy it exactly.
A Complete Guide to create an llms.txt Generator Plugin in WordPress
This overview explains how to build a wordpress plugin that generates an llms.txt file, helping site owners control how AI systems use their content.
Step1: Create the plugin structure
Start by creating a new plugin folder
wp-content/plugins/llms-txt-generator/
Inside the folder, create the main plugin file
llms-txt-generator.php
Add plugin header:
<?php
/**
* Plugin Name: llms.txt Generator
* Description: llms.txt generator to control how AI systems use website content.
* Version: 1.0.0
* Author: Simplileap
*/
defined('ABSPATH') || exit;
This generates a plugin safely in WordPress.
Step2: Register rewrite rule for llms.txt
By default WordPress does not recognize llms.txt.
We need to instruct WordPress to internally handle requests to /llms.txt
/**
* -------------------------------------------------
* 1. Register rewrite rule for /llms.txt
* -------------------------------------------------
*/
add_action('init', function () {
add_rewrite_rule(
'^llms\.txt$',
'index.php?llms_txt=1',
'top'
);
});
Step 3: Register a Query Variable
Next we add a custom query variable, so wordpress can recognize it.
add_filter('query_vars', function ($vars) {
$vars[] = 'llms_txt';
return $vars;
});
This allows WordPress to identify when a request is specifically meant for llms.txt
Step 4: Serve the llms.txt Response
Now we capture the request and return the llms.txt content.
add_action('template_redirect', function () {
if (get_query_var('llms_txt')) {
header('Content-Type: text/plain; charset=utf-8');
header('Cache-Control: public, max-age=3600');
echo llms_txt_generate_content();
exit;
}
});
Key Points:
Returns plain text only
Ends WordPress execution properly
Prevents themes or other plugins from affecting the response
This ensures llms.txt is returned cleanly and exactly as expected.
Step 5: Generate the llms.txt content
Create a function that defines the content of llms.txt
function llms_txt_generate_content() {
$options = get_option('llms_txt_settings', [
'ai_train' => 'no',
'ai_input' => 'yes',
'ai_output' => 'limited',
]);
Step 6: Flush Rewrite Rules on Activation
Rewrite rules must be flushed once when the plugin is activated.
register_activation_hook(__FILE__, function () {
flush_rewrite_rules();
});
register_deactivation_hook(__FILE__, function () {
flush_rewrite_rules();
});
This ensures /llms.txt works immediately after activation.
Step7: Complete llms.txt Generator Plugin Code
<?php
/**
* Plugin Name: llms.txt Generator
* Description: Production-grade llms.txt generator to control how AI systems use website content.
* Version: 1.0.0
* Author: Simplileap
*/
defined('ABSPATH') || exit;
/**
* -------------------------------------------------
* 1. Register rewrite rule for /llms.txt
* -------------------------------------------------
*/
add_action('init', function () {
add_rewrite_rule(
'^llms\.txt$',
'index.php?llms_txt=1',
'top'
);
});
/**
* -------------------------------------------------
* 2. Register query var
* -------------------------------------------------
*/
add_filter('query_vars', function ($vars) {
$vars[] = 'llms_txt';
return $vars;
});
/**
* -------------------------------------------------
* 3. Serve llms.txt
* -------------------------------------------------
*/
add_action('template_redirect', function () {
if (get_query_var('llms_txt')) {
header('Content-Type: text/plain; charset=utf-8');
header('Cache-Control: public, max-age=3600');
echo llms_txt_generate_content();
exit;
}
});
/**
* -------------------------------------------------
* 4. Generate llms.txt content
* -------------------------------------------------
*/
function llms_txt_generate_content() {
$options = get_option('llms_txt_settings', [
'ai_train' => 'no',
'ai_input' => 'yes',
'ai_output' => 'limited',
]);
$lines = [
'# llms.txt – AI Usage Policy',
'# Generated by WordPress',
'',
'ai-train: ' . sanitize_text_field($options['ai_train']),
'ai-input: ' . sanitize_text_field($options['ai_input']),
'ai-output: ' . sanitize_text_field($options['ai_output']),
];
return implode("\n", $lines) . "\n";
}
/**
* -------------------------------------------------
* 5. Plugin activation / deactivation
* -------------------------------------------------
*/
register_activation_hook(__FILE__, function () {
flush_rewrite_rules();
});
register_deactivation_hook(__FILE__, function () {
flush_rewrite_rules();
});
/**
* -------------------------------------------------
* 6. Admin menu
* -------------------------------------------------
*/
add_action('admin_menu', function () {
add_options_page(
'llms.txt Settings',
'llms.txt',
'manage_options',
'llms-txt',
'llms_txt_settings_page'
);
});
/**
* -------------------------------------------------
* 7. Register settings
* -------------------------------------------------
*/
add_action('admin_init', function () {
register_setting('llms_txt_group', 'llms_txt_settings');
add_settings_section(
'llms_txt_main',
'AI Usage Policy',
'__return_false',
'llms-txt'
);
add_settings_field('ai_train', 'Allow AI Training', 'llms_txt_field_ai_train', 'llms-txt', 'llms_txt_main');
add_settings_field('ai_input', 'Allow AI Input', 'llms_txt_field_ai_input', 'llms-txt', 'llms_txt_main');
add_settings_field('ai_output', 'AI Output Usage', 'llms_txt_field_ai_output', 'llms-txt', 'llms_txt_main');
});
/**
* -------------------------------------------------
* 8. Settings fields
* -------------------------------------------------
*/
function llms_txt_field_ai_train() {
$options = get_option('llms_txt_settings');
?>
<select name="llms_txt_settings[ai_train]">
<option value="no" <?php selected($options['ai_train'] ?? '', 'no'); ?>>No</option>
<option value="yes" <?php selected($options['ai_train'] ?? '', 'yes'); ?>>Yes</option>
</select>
<?php
}
function llms_txt_field_ai_input() {
$options = get_option('llms_txt_settings');
?>
<select name="llms_txt_settings[ai_input]">
<option value="yes" <?php selected($options['ai_input'] ?? '', 'yes'); ?>>Yes</option>
<option value="no" <?php selected($options['ai_input'] ?? '', 'no'); ?>>No</option>
</select>
<?php
}
function llms_txt_field_ai_output() {
$options = get_option('llms_txt_settings');
?>
<select name="llms_txt_settings[ai_output]">
<option value="limited" <?php selected($options['ai_output'] ?? '', 'limited'); ?>>Limited</option>
<option value="yes" <?php selected($options['ai_output'] ?? '', 'yes'); ?>>Allowed</option>
<option value="no" <?php selected($options['ai_output'] ?? '', 'no'); ?>>Not Allowed</option>
</select>
<?php
}
/**
* -------------------------------------------------
* 9. Settings page UI
* -------------------------------------------------
*/
function llms_txt_settings_page() {
?>
<div class="wrap">
<h1>llms.txt Settings</h1>
<p>Control how AI systems and large language models use your website content.</p>
<form method="post" action="options.php">
<?php
settings_fields('llms_txt_group');
do_settings_sections('llms-txt');
submit_button();
?>
</form>
<hr>
<h2>Preview</h2>
<pre style="background:#f7f7f7;padding:12px;border:1px solid #ddd;">
<?php echo esc_html(llms_txt_generate_content()); ?>
</pre>
<p>
File URL:
<code><?php echo esc_url(home_url('/llms.txt')); ?></code>
</p>
</div>
<?php
}
This final implementation handles everything required to generate and serve an llms.txt file correctly.
Result:
Go to Plugins search for llms.txt generator and activate it.
![]()
After activating the plugin:
1. Go to the WordPress Dashboard and search for settings → llms.txt
2. Review the default AI usage rules
3. Update the settings based on your content and usage preferences
4. Preview the generated llms.txt file
5. Visit /llms.txt in your browser to confirm if the file is accessible.

The plugin provides an easy to use interface that allows you to control how AI systems can interact with your website’s content.
Conclusion: As AI systems like ChatGPT, Gemini, Claude etc depend on website content to generate answers and insights, it’s important for website owners to clearly communicate as to how their content may be used. The llms.txt file offers a straightforward and simple way to define these rules–whether content can be used for training, summarized or restricted from being copied word to word.
Creating an llms.txt Generator Plugin for WordPress makes this approach simple and user friendly. Instead of manually maintaining files or writing code, site owners can control AI usage through an intrusive plugin interface.
As AI depends on website content, llms.txt helps site owners to protect their content and enable responsible AI engagement.

Driven by a relentless desire to learn and grow, I find myself exploring the domains of technology and web development. With boundless passion I am dedicated to progressing in my career and making significant contributions to the tech sector.
