[wp-trac] [WordPress Trac] #46418: Use wp_die() instead of die() function in wordpress

WordPress Trac noreply at wordpress.org
Wed Jul 1 08:13:09 UTC 2020

#46418: Use wp_die() instead of die() function in wordpress
 Reporter:  immeet94                 |       Owner:  SergeyBiryukov
     Type:  enhancement              |      Status:  reviewing
 Priority:  normal                   |   Milestone:  5.5
Component:  Administration           |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:

Comment (by thimalw):

 The comment above is right, we need to consider from which point on the
 wp_die function is available.

 There are instances of wp_die being used in load.php already, but the
 functions.php file is loaded in just in that spot each time.

 The index.php file in trunk is actually only used in development, so in
 production where _index.php is used, it actually seems to be loaded from
 https://core.trac.wordpress.org/browser/trunk/src/wp-load.php#L54 if wp-
 config.php doesn't exist, and from
 https://core.trac.wordpress.org/browser/trunk/src/wp-settings.php#L111 if
 wp-config.php exists. And there are quite a bit of files that are loaded
 in before wp_die is available, especially in the case where wp-config.php
 is available.

 So if we're going to start using wp_die in all or most instances, my
 suggestion is to move the function to the load.php file. There already
 seems to be other functions in load.php that were moved in from other
 files including functions.php.

Ticket URL: <https://core.trac.wordpress.org/ticket/46418#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list