\nRewriteCond %{HTTP:Accept} text/markdown [NC]\nRewriteRule .* - [E=Cache-Control:no-cache]\n";
$litespeed_block .= "RewriteCond %{REQUEST_URI} ^/(llms\\.txt)$ [NC]\nRewriteRule .* - [E=Cache-Control:no-cache]\n";
$litespeed_block .= "\n";
$block = "# BEGIN Agurel AI Agent Ready\n";
if ( ! empty( $rules ) ) {
$block .= "\nRewriteEngine On\n" . implode( "\n", $rules ) . "\n\n";
}
$block .= $litespeed_block;
$block .= "# END Agurel AI Agent Ready\n\n";
$content = $block . ltrim( $content );
file_put_contents( $htaccess, $content );
flush_rewrite_rules();
}
add_action( 'init', function() {
if ( get_option( 'agurel_rewrite_v', '' ) === '2' ) return;
update_option( 'agurel_rewrite_v', '2' );
$llms = get_option( 'agurel_llms_enabled', 'no' ) === 'yes';
agurel_write_htaccess( $llms );
}, 20 );
// Admin page
add_action( 'admin_menu', function() {
add_options_page( 'Agurel AI Agent Ready Lite', 'Agurel AI Agent Ready Lite', 'manage_options', 'agurel-ai-agent-ready-lite', 'agurel_lite_admin_page' );
});
function agurel_lite_admin_page() {
if (
isset( $_POST['agurel_lite_nonce'] ) &&
wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['agurel_lite_nonce'] ) ), 'agurel_lite_save' ) &&
current_user_can( 'manage_options' )
) {
$llms = isset( $_POST['agurel_llms_enabled'] );
update_option( 'agurel_llms_enabled', $llms ? 'yes' : 'no' );
agurel_write_htaccess( $llms );
echo '
';
}
$llms_enabled = get_option( 'agurel_llms_enabled', 'no' );
$llms_exists = file_exists( ABSPATH . 'llms.txt' );
?>
Agurel AI Agent Ready Lite
Your site is now serving clean Markdown to AI agents automatically.
✅
Active Features
Markdown Negotiation
- ✓All Assistant Bots (ChatGPT-User, ClaudeBot, Perplexity-User...)
- ✓All Search Bots (OAI-SearchBot, PerplexityBot, BingBot, YandexBot...)
- ✓All Training Bots (GPTBot, anthropic-ai, CCBot...)
Discovery & Signals
- ✓RFC 8288 Link headers for agent discovery
- ✓Content Signals (meta tag + robots.txt)
AI Search Signals
⚠️ If you use an SEO plugin (All in One SEO, Yoast, Rank Math), verify that Content Signals appear in your robots.txt. If not, add manually: Content-Signal: ai-train=no, search=yes, ai-input=yes
⚡
Upgrade to Pro
- 🔒 Bot Management Dashboard
- 🔒 Training Bot Control — enable/disable individually
- 🔒 MCP Server Card (
/.well-known/mcp.json)
- 🔒 A2A Agent Card (
/.well-known/agent.json)
- 🔒 Configurable Content Signals
- 🔒 Custom llms.txt content
- 🔒 llms-full.txt — full page content for AI agents
- 🔒 AI-Optimized robots.txt — auto-generated with all AI agents listed
- 🔒 AI Search Signals — JSON-LD schema (Article, WebPage, WebSite) + Author Override
- 🔒 Advanced Schema — LocalBusiness, Organization, Service, Person, FAQPage
- 🔒 Markdown Cache — faster AI responses via postmeta caching
Get Pro →
; rel="sitemap"', false );
header( 'Link: <' . home_url( '/llms.txt' ) . '>; rel="describedby"', false );
header( 'X-Agurel-Ecosystem: agurel-ai-agent-ready-lite', false );
}, 1 );
// Content Signals — meta tag
add_action( 'wp_head', function() {
echo '' . "\n";
}, 1 );
// Content Signals — robots.txt fallback
add_filter( 'robots_txt', function( $output ) {
$output .= "\nContent-Signal: ai-train=no, search=yes, ai-input=yes";
return $output;
}, 10, 1 );
// Query vars
add_filter( 'query_vars', function( $vars ) {
$vars[] = 'agurel_llms';
return $vars;
});
add_action( 'template_redirect', function() {
// llms.txt — site index with summaries
if ( get_query_var( 'agurel_llms' ) ) {
status_header( 200 );
$out = get_transient( 'agurel_llms_cache' );
if ( false === $out ) {
$posts = get_posts( array(
'post_type' => array( 'post', 'page' ),
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'DESC',
));
$out = '# ' . get_bloginfo('name') . "\n\n";
$desc = get_bloginfo('description');
if ( $desc ) $out .= '> ' . $desc . "\n\n";
$out .= '> URL: ' . home_url() . "\n\n";
$out .= "## Pages\n\n";
foreach ( $posts as $p ) {
$excerpt = '';
if ( $p->post_excerpt ) {
$excerpt = $p->post_excerpt;
} else {
$raw = strip_shortcodes( $p->post_content );
$raw = wp_strip_all_tags( $raw );
$excerpt = wp_trim_words( $raw, 20, '...' );
}
$out .= '- [' . $p->post_title . '](' . get_permalink($p) . ')';
if ( $excerpt ) $out .= ' — ' . $excerpt;
$out .= "\n";
}
// Cached for 7 days as a safety net; save_post/trashed_post below
// clear it immediately whenever content actually changes.
set_transient( 'agurel_llms_cache', $out, 7 * DAY_IN_SECONDS );
}
header( 'Content-Type: text/plain; charset=UTF-8' );
header( 'Cache-Control: no-store' );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $out;
exit();
}
// Markdown content negotiation
$accept = isset( $_SERVER['HTTP_ACCEPT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_ACCEPT'] ) ) : '';
if ( strpos( $accept, 'text/markdown' ) === false ) {
return;
}
// Cache bypass — major cache eklentileri
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
if ( ! defined( 'DONOTCACHEPAGE' ) ) define( 'DONOTCACHEPAGE', true );
if ( ! defined( 'DONOTCACHEOBJECT' ) ) define( 'DONOTCACHEOBJECT', true ); // phpcs:ignore
if ( ! defined( 'DONOTCACHEDB' ) ) define( 'DONOTCACHEDB', true ); // phpcs:ignore
if ( function_exists( 'nocache_headers' ) ) nocache_headers();
header( 'Vary: Accept', false );
header( 'Cache-Control: no-store, no-cache, must-revalidate', true );
// LiteSpeed Cache
if ( function_exists( 'litespeed_vary_hash' ) ) {
add_filter( 'litespeed_vary', function( $vary ) {
if ( isset( $_SERVER['HTTP_ACCEPT'] ) && stripos( $_SERVER['HTTP_ACCEPT'], 'text/markdown' ) !== false ) {
$vary[] = 'accept-markdown';
}
return $vary;
});
}
// WP Rocket
add_filter( 'do_rocket_generate_caching_files', '__return_false' );
// WP Fastest Cache
add_filter( 'wpfc_exclude_current_page', '__return_true' );
// SG Optimizer
add_filter( 'sg_cachepress_skip_html_cache', '__return_true' );
// LiteSpeed Cache
if ( function_exists( 'litespeed_vary_hash' ) ) {
add_filter( 'litespeed_vary', function( $vary ) {
if ( isset( $_SERVER['HTTP_ACCEPT'] ) && stripos( $_SERVER['HTTP_ACCEPT'], 'text/markdown' ) !== false ) {
$vary[] = 'accept-markdown';
}
return $vary;
});
}
$post = get_queried_object();
if ( $post instanceof WP_Post && $post->post_status === 'publish' ) {
$raw = strip_shortcodes( $post->post_content );
$raw = wp_strip_all_tags( $raw );
$raw = html_entity_decode( $raw, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
$raw = preg_replace( '/\n{3,}/', "\n\n", $raw );
$raw = trim( $raw );
$md = '# ' . $post->post_title . "\n\n";
$md .= '> URL: ' . get_permalink( $post ) . "\n";
$md .= "\n---\n\n" . ( $raw ?: '_Visual content._' );
} else {
$md = '# ' . get_bloginfo( 'name' ) . "\n\n" . get_bloginfo( 'description' ) . "\n\n> URL: " . home_url();
}
header( 'Content-Type: text/markdown; charset=UTF-8' );
header( 'X-Markdown-Tokens: ' . (int)( strlen( $md ) / 4 ) );
header( 'Cache-Control: no-store' );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $md;
exit();
}, 1 );
// llms.txt önbelleğini, ilgili içerik değiştiğinde geçersiz kılar
add_action( 'save_post', function( $post_id ) {
if ( ! in_array( get_post_type( $post_id ), array( 'post', 'page' ), true ) ) return;
delete_transient( 'agurel_llms_cache' );
});
add_action( 'trashed_post', function( $post_id ) {
if ( ! in_array( get_post_type( $post_id ), array( 'post', 'page' ), true ) ) return;
delete_transient( 'agurel_llms_cache' );
});
add_action( 'before_delete_post', function( $post_id ) {
if ( ! in_array( get_post_type( $post_id ), array( 'post', 'page' ), true ) ) return;
delete_transient( 'agurel_llms_cache' );
});
register_activation_hook( __FILE__, function() {
$llms = get_option( 'agurel_llms_enabled', 'no' ) === 'yes';
agurel_write_htaccess( $llms );
});
register_deactivation_hook( __FILE__, function() {
agurel_write_htaccess( false );
});