The robtos file is an agreement between a website and a search engine spider. This agreement tells the search engine spider which files should not be crawled and which files should be crawled first.
Sites tell search engines which pages can be crawled and which pages can not be crawled through Robots protocol. Robots place them in the root directory of the site by default. You can access the newly built WordPress website when you open robots.txt, but you can’t find any robots.txt file in the website directory. In fact, the default robots file is placed in wp-includes/functions.php. By searching for robots, the modification can be made at about line 1319.