How to Fix Robots.txt Blocking admin-ajax.php
How to resolve How to Fix Robots.txt Blocking admin-ajax.php?
Fix robots.txt blocking admin-ajax.php by adding 'Allow: /wp-admin/admin-ajax.php' directly beneath 'Disallow: /wp-admin/' so search engine renderers can load dynamic WordPress scripts and content.
Symptoms & Diagnostic Indicators
Open Google Search Console URL Inspection > View Tested Page > More Info > Page Resources to see if admin-ajax.php is blocked by robots.txt. Paste your robots.txt into a local RFC 9309 tester and test '/wp-admin/admin-ajax.php'.
Common Root Causes
A blanket 'Disallow
A blanket 'Disallow: /wp-admin/' rule without an explicit Allow exception blocks Googlebot from fetching admin-ajax.php.
Themes or plugins that load dynamic listings
Themes or plugins that load dynamic listings, filters, or styles via admin-ajax.php fail to render properly during Googlebot's headless Chrome pass.
Step-by-Step Fix
Add the Explicit Allow Exception
Update your robots.txt so /wp-admin/ remains disallowed while admin-ajax.php is explicitly permitted.
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.phpVerify Precedence Locally
Confirm that /wp-admin/admin-ajax.php evaluates as ALLOWED while /wp-admin/edit.php remains BLOCKED.
Prevention & Verification Checklist
- Never block /wp-content/themes/ or /wp-includes/ JS and CSS assets
- Test robots.txt edits locally before publishing
Test Your WordPress robots.txt Rules
Validate Allow and Disallow precedence locally with our free RFC 9309 tester.
Open Robots.txt Tester