I don't usually tweet about #SEO, but this is important. Is a static robots.txt file good for WordPress performance? Let's find out!

To display the default robots.txt, a fresh WordPress install will: 🧵
Run 15 SQL queries: load all options, can_compress_scripts, WPLANG, query last 10 posts, query the recent posts widget options, query terms, taxonomies, etc., for found posts, all post metadata for found posts, recent comments widget, recent entries widget and a few others. Image
Call file_get_contents() 61 times to register some core Gutenberg blocks, that's in addition to json_decode() each file, and about 100 calls to file_exists() on those files. Image
Register 22 post types, 24 post statuses, 22 sidebar widgets, 12 taxonomies, 7 block pattern categories, 10 block styles, 3 image sizes.
It will call gettext translations: 1917 times for regular strings, and 875 times for strings with context. I'm so lucky I'm using the default locale. Oh and exactly 0 of those strings are used in robots.txt. Image
Check whether the front page has been set as a static page, and whether the request is_front_page() or is_home(). Also is_single(), is_feed(), is_admin(), is_category(), is_search(), the list goes on.
Check whether the user is logged in, 14 times, and whether we need to display an admin bar, also heartbeat settings. It will also attempt to read the user session, and create 3 nonces. Reminder: this is an anonymous request.
Escape some HTML 78 times. Reminder: robots.txt is a plain/text file, there's no HTML. It will check whether the admin needs to be forced SSL. It will also initialize smilies, and Twenty Twenty One "dark mode"
Run 83 unique actions (one of them is do_robotstxt) and apply 530 unique filters (one of them is robots_txt).
All combined, that's > 42,000 function calls at 5.46 megs peak memory, about 100 ms wall time. So yes, by all means, please use a static robots.txt file.

If you would like to help clean this mess up, here is a good start: core.trac.wordpress.org/ticket/10886

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Konstantin Kovshenin

Konstantin Kovshenin Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(