admin管理员组

文章数量:1410682

Every time I read about making changes to wp-config.php, the advice given is to make changes before this line:

/* That's all, stop editing! Happy publishing. */

Why?

What is special about that line? Surely the parser is smart enough to handle stuff that comes after it? There of course IS stuff that comes after it.

Every time I read about making changes to wp-config.php, the advice given is to make changes before this line:

/* That's all, stop editing! Happy publishing. */

Why?

What is special about that line? Surely the parser is smart enough to handle stuff that comes after it? There of course IS stuff that comes after it.

Share Improve this question asked Dec 4, 2019 at 7:56 lonixlonix 3011 silver badge10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

There's no "parser" that needs to be "smart". It's just a PHP file that runs as part of WordPress loading. The reason you need to put edits before that line is because the line that comes after it is this:

require_once( ABSPATH . 'wp-settings.php' );

And this line basically loads all of WordPress. So any definitions added to wp-config.php after that line will be useless because WordPress has already finished loading.

You could conceivably add code between the comment from your question and this line, but the existing lines that are already there are checking for the existence of the ABSPATH constant, which means that if you wanted to redefine ABSPATH yourself, you need to do that before the "That's all" line.

So instead of saying something silly like "Define ABSPATH before this line, but it's ok to make other changes after this line, just make sure not to make them after the last line", it just suggests making all edits above those lines.

There's no good reason to ignore this comment.

本文标签: configurationWhy edits to wpconfigphp must come before quotThat39s allquot comment