Losing clicks to competitors? Find out exactly why, and what to fix first.

Show me why
Skip to content

Technical SEO

WordPress Robots.txt: Where It Is, How to Edit It and What to Include

Add saadrazaseo.com as a preferred source on Google

Takes about a minute. You hear back from me personally.

WordPress creates a virtual robots.txt file for you at yourdomain.com/robots.txt if no physical file exists. You can change it by uploading your own file or by using the editor in an SEO plugin. A safe starting point blocks the admin area, allows the AJAX endpoint and lists your sitemap, without blocking scripts, styles or images.

Where the file is

Open yourdomain.com/robots.txt in a browser. If you see output but find no file in your hosting folder, WordPress is generating it on the fly. Uploading a real robots.txt file to the site root overrides that virtual version.

A sensible default

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://www.example.com/sitemap_index.xml

Use your own sitemap URL. Build and adjust the file with my free robots.txt generator.

Not sure if this is hurting your site?

Get the fixes that matter most, in priority order.

Find my blockers

How to edit it

  1. Use the file editor in your SEO plugin, if it offers one.
  2. Or create a plain text file named robots.txt and upload it to the site root through your host.
  3. Reload the address in a browser to confirm the change.
  4. Check specific URLs in the robots.txt tester.

What not to block

Do not block theme or plugin folders that deliver CSS and JavaScript, and avoid blocking the uploads folder. Google needs these files to render pages the way a visitor sees them.

The search visibility setting

WordPress has a setting under Reading that asks search engines not to index the site. It is useful during development, but if it stays on after launch your pages can disappear from search. Always check it when a site goes live.

Robots.txt is not a privacy tool

The file is public, and listing a folder in it can point curious people to it. To keep content out of search, use noindex or password protection, as explained in noindex vs canonical vs robots.txt. For the fundamentals, read what robots.txt is and why it matters for SEO.

Frequently asked questions

Should I block my search results pages?

Internal search results often create near-endless URLs, so many sites block them. Check your own crawl data before deciding.

Can a plugin change my robots.txt without me noticing?

Yes. Recheck the live file after installing or updating SEO, security or caching plugins.

Next steps

If your WordPress site has indexing problems, contact me here for a technical SEO review.

More in this series (robots.txt questions): start with Free Robots.txt Generator, then explore:

Is this holding your site back?

Share your website and I will look at the technical issues holding it back.

Your details are only used to reply to your request. No spam.

Grow my trafficCall