为什么wp-blog-header与索引分开?

What it the advantages of having the code in wp-blog-header.php seperate from index.php in wordpress?

I tried to move the code in wp-blog-header.php to index.php and the website loads perfectly fine, I think.

Could someone please explain about the advantage of running a require function in index to call wp-blog-header instead to writing the wp-blog-header code in index

Code reuse. There is not only index.php as entry-script. Every entry-script that wan't to load Wordpress core library functionalities and templating functionalities can require that file.

Using require/include(_once) is the historic way in PHP to do code-reuse.

  • include has/is often used for (HTML) tamplating code.
  • require is more often used for PHP program code, like function and class definitions.

These are not rules set in stone, it's more what common usage patterns are. Both are very close to each other: