Robots.txt in WordPress for SEO

Many website managers heavily focus on search engine optimization (SEO) because of how the search engines operate. Search engines send out bots known as crawlers to index websites and convey the date back to the search engine. The majority of websites have options to include instructions to these crawlers via a text file like Robots.txt in WordPress. A robots.txt file provides the crawler with a site map and a list of any sections that requires no indexing. For example, blank pages, as these can negatively impact your organic search results. In the following text, you will learn everything you need to understand about robots.txt as a WordPress admin, SEO manager, or site operator.

The uses of Robots.txt in WordPress

The bots that search engines regularly send out to search websites for new content are known by several names; crawlers, spiders, or search bots. Including a robots.txt is essential because it is one of the only ways for you to interact with these bots. Implementing a well-written robots.txt file will allow you to instruct bots where they should index first. It will also help you to instruct them on areas of your site that require no indexing. Because each search engine uses its own bots, you can give specific instructions to each individual search engine should you wish. This means that search bots from Google, Yahoo, Bing, and others could each behave differently according to your instructions.

robots.txt in WordPress

Robots.txt Location in WordPress

WordPress automatically creates a virtual robots.txt file when you first create a website. Furthermore, it adds to it each time you add a page or content to your site. However, most WP admins and SEO managers will find having their own robots.txt additions very useful. If you create and add a robots.txt file to the root directory of your WordPress site, it takes precedence over the automatically generated one from WordPress. To check whether your site is already using a robots.txt file, simply add /robots.txt to the end of your URL, then press enter. If your site is already using a robots.txt file, you will now be looking at the instructions your site provides to bots looking to index it for search engines.

How to Edit a Robots.txt File

It is very easy to edit a robots.txt file using any text editor. If your text editor allows you to save a file as .txt, you can use it to create or make changes to your robots.txt file. After you complete editing your robots.txt file, you will need to upload it to the root directory of your site, overwriting the previous one. Once you have the text editor open, you may add any lines and commands for the crawlers that are helpful for your site. When learning about how robots.txt files work, it is best to use User-agent: as it lets the crawlers know the instructions are for all search engine bots.

Robots.txt Guide

Robots.txt Commands

Search engine crawlers will read your robots.txt file and, as such, should be written in lines of code. Below you can find the most common robots.txt commands for your file.

  • You should begin your .txt file with the line User-agent: as this command informs the bot that you are giving it instructions.
  • After User-agent: you should then either list each bot individually or use an asterisk * in order to include all of the crawler bots at once.
  • Allow: is a command that tells the bot where they are allowed to index. However, every page is automatically allowed. Therefore, it makes more sense to use other commands to direct the bots where to go.
  • Disallow: This is a very handy command. You can use this command to prevent the bots from indexing your chosen pages.
  • Sitemap: This command provides the bots with your sitemap’s location for their use.

You can use these commands to guide the crawlers through your website. It would consequently help you to rank higher in search engine results pages(SERPs). As the crawlers read the file following the Robots Exclusion Standard Protocol (REP), they read the file line by line. They are also sensitive to upper and lower cases. This case sensitivity is the reason why you must save your robots.txt file name entirely in lower case. Each line of the .txt file should contain only a single command. Also, the allow command has priority over the disallow command. Therefore, you can disallow an entire directory and then use the allow command to have the bot index a single page or subdirectory of the disallowed file path.

Introduction to robots.txt

How to Optimize the Robots.txt in WordPress

It is possible to edit the automatically created robots.txt file found within the wp-functions.php file. To edit this file, you can use Notepad++. Unfortunately, any time that WordPress receives an update, your changes get overwritten with the default settings again. You can save time by creating your own robots.txt file and saving it to the root directory of your domain. Once you have established the robots.txt file in your root directory, it always takes precedence over the automatic one created by WordPress.

The robots.txt file is vital in controlling the behavior of search engines when they crawl and index your site. If restricted too much, important content may fail to rank and may not even appear in the SERPs at all. Inversely, if you don’t restrict the crawlers enough, content could be indexed more than once and lower your ranking. There are also many plugins available for WordPress which can help you create the file through the WordPress backend.

WordPress Plugins

WordPress Plugins

Here are two of the most popular plugins on robots.txt file and WordPress SEO.

Yoast SEO

This plugin can help you to create and edit the robots.txt file under their tools menu. Yoast is one of the most popular and trusted plugins available for WordPress. It has features to help make your site rank higher in SERPs. It can guide you through creating SEO-friendly content or help you write robots.txt files. Yoast SEO is very user-friendly, and as it is widely used, there are many places to ask for advice about the plugin from other users.

All in one SEO

All in one SEO is another plugin to help you on your SEO journey. Trusted by over two million websites and it can help you with every aspect of SEO. The all-in-one SEO plugin has a beautiful variety of features that are quite advantageous for improving your site SEO and the efficiency of your robots.txt file.


Overall, it is easy to find and edit the robots.txt file in WordPress. There are also many plugins that can do it for you while providing you with access to a whole host of other SEO benefits for your site. Hopefully, you have learned both about the WordPress robots.txt location and a little about SEO and search engine crawlers. Thank you for reading.

What is Interaction to Next Paint (INP) & How to Optimize It?
What is Interaction to Next Paint (INP) & How to Optimize It?

Google recently changed the balance by introducing a metric called next-paint engagement (INP) to track page experience. INP stands out as an empirica...

H1 Tag Missing Or Empty Warning
H1 Tag Missing Or Empty Warning

The digital world has wonders, however, it is not perfect. Sometimes there can be problems. In this world where algorithms waltz and crawlers choreogr...

Frequently Asked Questions About

You can block all bots from indexing your site by using the below commands:

Disallow: /

These lines will prevent any crawler from indexing any part of your site. Whether you prevent certain pages or the entire site is up to you.

No, not all websites use a robots.txt file to interact with search bots. However, if you don’t have a robots.txt file in place, the bots will index everything, which could negatively impact your organic search engine rank.

Using a robots.txt file can significantly benefit your site SEO because it enables you to hide any section of your site that has yet to be optimized for search engines, therefore, increasing your organic search rank. SEO is vital for your site so that it can be found more easily using search engines which is where the vast majority of all web traffic is generated from.

You don’t have to use a robots.txt file on your site. But there are clear benefits available in using this file to interact with crawlers and index higher in search engines.

Search engines use crawlers to index websites because there are so many websites on the worldwide web, and they need a way to order them for when a user searches for something. By indexing your site, the search engine has a file telling it about the information contained within your site that it uses to display your site to users searching for that information.

Fatih Karadeniz

Posts: 33

Hi my name is Fatih Karadeniz. I graduated from English Language and Literature Department and I have developed an interest in researching and writing about SEO and Digital Marketing related topics.

Be the First to Comment on Robots.txt in WordPress for SEO

Your email address will not be published. Required fields are marked *

(Total: 34 Average: 5 )

No comments to show.