configuration - Why edits to wp-config.php must come before "That's all" comment

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

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744941442a4602350.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信