[wp-trac] [WordPress Trac] #25148: Call wp_plugin_directory_constants before loading drop in files

WordPress Trac noreply at wordpress.org
Mon Aug 26 17:49:10 UTC 2013


#25148: Call wp_plugin_directory_constants before loading drop in files
--------------------------------------------+------------------------------
 Reporter:  andreasnrb                      |       Owner:
     Type:  enhancement                     |      Status:  new
 Priority:  normal                          |   Milestone:  Awaiting Review
Component:  General                         |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  2nd-opinion dev-feedback close  |
--------------------------------------------+------------------------------
Changes (by nacin):

 * keywords:  2nd-opinion dev-feedback => 2nd-opinion dev-feedback close


Comment:

 In single-site, I'm not sure I see the harm here. But the reason these
 constants wait until just before mu-plugins get loaded is because these
 constants can be set in sunrise.php (in multisite). Changing this could
 break quite a bit. And, I'm not sure I see the need...

 It seems like all of the main drop-ins would be affected — db.php,
 advanced-cache.php, and object-cache.php. But for use in inclusion, I
 don't think one should use WP_PLUGIN_DIR. Instead, `__DIR__` (5.3+) or
 `dirname( __FILE__ )` (5.2) should be used. Knowing WP_PLUGIN_DIR isn't
 necessarily enough to identify your plugin's full path. You should instead
 always base things off the main file.

 Beyond that, ideally any kind of processing can wait for muplugins_loaded
 or plugins_loaded, at which point the URL constants and such are defined.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25148#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list