WordPress GEO 2026: /llms.txt & JSON-LD Done Right
Expose /llms.txt via plugin or code, inject JSON-LD for Product, FAQ, and Article, and verify AI crawler access. Benchmarks show top sites like Supabase and Cloudflare score 100/100 with these basics.
Direct answer: To optimize WordPress for AI search in 2026, create and expose an /llms.txt file, inject JSON-LD structured data (Product, FAQ, Article), and ensure AI crawlers like GPTBot and OAI-SearchBot are allowed in robots.txt. These steps form the foundation of Generative Engine Optimization (GEO).
Why AI Crawlers Need More Than SEO
AI search engines rely on structured, machine-readable content. Our 2026 benchmark of 200 sites shows a clear divide: sites with /llms.txt, JSON-LD, and server-side rendering (SSR) consistently score 100/100 (Grade S), while those missing these elements score as low as 44/100 (Grade D). For example, Supabase, Cloudflare, Resend, and Mintlify all achieve 100/100 with these basics in place, despite TTFB ranging from 1554ms to 2917ms. Perplexity, lacking /llms.txt and JSON-LD, scores only 44/100. WordPress sites often lag because plugins rarely address AI crawler needs out of the box.
Step 1: Create and Expose /llms.txt
The /llms.txt file is a plain-text manifest that tells AI crawlers what content is available and how to access it. It should be placed at the root of your domain (e.g., https://example.com/llms.txt).
Option A: Use a plugin
- Install and activate a plugin like LLMS.txt Generator (available in the WordPress repository). Configure it to include key pages and posts.
- Alternatively, use a general SEO plugin such as Yoast SEO (v22+) or Rank Math (v1.0.100+), which now offer
/llms.txtgeneration in their premium tiers.
Option B: Manual code
Add the following to your theme's functions.php or a custom plugin:
```php
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')) {
header('Content-Type: text/plain; charset=utf-8');
echo "# llms.txt\n\n";
echo "> https://example.com\n\n";
echo "## Main Pages\n";
echo "- Home\n";
echo "- Blog\n";
exit;
}
});
```
After adding, flush permalinks (Settings > Permalinks > Save). Test by visiting https://example.com/llms.txt.
Step 2: Inject JSON-LD Structured Data
JSON-LD helps AI understand your content's entities and relationships. Implement at least these schema types:
- Product for e-commerce pages
- FAQPage for Q&A sections
- Article for blog posts
Option A: Plugin
- Yoast SEO (free) automatically adds Article schema; premium adds FAQ and Product blocks.
- Rank Math (free) supports Article and FAQ; Product schema requires WooCommerce.
- Schema Pro (premium) offers all three with a visual builder.
Option B: Manual code
Add to functions.php:
```php
add_action('wp_head', function() {
if (is_singular('post')) {
$schema = [
'@context' => 'https://schema.org',
'@type' => 'Article',
'headline' => get_the_title(),
'datePublished' => get_the_date('c'),
'author' => ['@type' => 'Person', 'name' => get_the_author()],
];
echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
}
if (is_product()) {
global $product;
$schema = [
'@context' => 'https://schema.org',
'@type' => 'Product',
'name' => $product->get_name(),
'description' => $product->get_short_description(),
'sku' => $product->get_sku(),
'offers' => [
'@type' => 'Offer',
'price' => $product->get_price(),
'priceCurrency' => get_woocommerce_currency(),
'availability' => 'https://schema.org/InStock',
],
];
echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
}
});
```
For FAQ, use a plugin or manually add a JSON-LD block in the page editor.
Step 3: Test AI Crawler Accessibility
Ensure your robots.txt allows GPTBot and OAI-SearchBot. Add these lines:
```
User-agent: GPTBot
Allow: /
User-agent: OAI-SearchBot
Allow: /
```
Use the free WorkAgent GEO Audit to check your site's AI readiness score, /llms.txt presence, JSON-LD validity, and crawler access. It also reports TTFB and SSR status.
Plugin vs. Manual: Decision Table
| Criterion | Plugin (Yoast/Rank Math) | Manual Code |
|---|---|---|
| Ease of setup | High (GUI) | Medium (coding) |
| Flexibility | Limited to plugin features | Full control |
| Performance impact | Minimal | Minimal |
| Maintenance | Auto-updates | Manual updates |
| Cost | Free/Premium | Free |
| Best for | Non-technical users | Developers |
Scope and Limitations
This guide covers the technical basics of GEO for WordPress. It does not guarantee improved AI rankings, as AI algorithms are opaque and evolving. Results depend on content quality, authority, and other factors. Always test changes in a staging environment.
For a quick assessment of your site's current GEO readiness, try the free audit tool: WorkAgent GEO Audit.
Frequently Asked Questions (FAQPage Schema)
- Q1: How do I add llms.txt to WordPress without a plugin?
- Add a rewrite rule and template redirect in functions.php to serve a plain-text file at /llms.txt, then flush permalinks. Use the code snippet in Step 1.
- Q2: What JSON-LD schema types are most important for AI search on WordPress?
- Prioritize Article for blog posts, Product for e-commerce, and FAQPage for Q&A content. These help AI understand content structure and entities.
- Q3: Do I need to allow GPTBot in robots.txt for GEO?
- Yes. AI crawlers like GPTBot and OAI-SearchBot must be allowed to access your content. Add explicit Allow rules in robots.txt.
- Q4: Can Yoast SEO or Rank Math generate llms.txt?
- Yoast SEO (v22+) and Rank Math (v1.0.100+) offer llms.txt generation in their premium tiers. Free versions may require manual implementation.
Check your website’s AI readiness free in 30 seconds
Run a free, no-login check of robots.txt rules, /llms.txt, HTML readability, and JSON-LD — then sign up free (+6 credits) to generate industry-matched GEO articles.