#26592 closed feature request (fixed)
Allow ABSPATH to be set outside of wp-load.php
Reported by: | jeichorn | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.6 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Bootstrap/Load | Keywords: | 4.6-early has-patch |
Focuses: | Cc: |
Description
When wp-load.php is a symlink ABSPATH gets set to a value that works for most things but is incorrect. The most obvious problem is paths to plugin assets will 404. Rather than solve this immediate problem it seems easier to allow for ABSPATH to be set outside of wp-load. That way it covers any other use cases and doesn't add a performance hit.
Adding an "if (!defined('ABSPATH'))" before defining the value would cover things.
It might be nice to also change wp-cron.php to check for a different constant, maybe even something like WP_LOADED, but its less important since its a special case that is easy to work around.
Attachments (1)
Change History (15)
#2
@
11 years ago
Can you explain a situation such as this with a bit more detail, preferably with an example?
ABSPATH is set to the canonical location of the files, and shouldn't be used to determine the location of plugin files or URL's.
It somewhat sounds like you need to define WP_CONTENT_DIR + WP_CONTENT_URL in your environment, but I'm not sure.
#4
@
11 years ago
There are a couple of things going on.
The first is that every config constant is user definable except for ABSPATH
The second was, the plugin dir was just an example of the problems (and you are correct that setting WP_CONTENT_DIR should fix that).
Looking at my notes more, the unsolvable problem is loading wp-config.php
In our case wp-load.php lives in /wordpress/wp-load.php
The wp-config.php lives in /username/current/wp-config.php
wp-load.php tries to load wp-config using ABSPATH and fails.
It might be slightly better (some symlinks aren't required) to make the location of wp-config.php an overridable constant rather then making ABSPATH, but thats a more complicated solution
#8
@
10 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
I don't see a pressing need to support this. If you wanted, you could put a wp-config.php file in /wordpress/ or at / that simply includes the wp-config.php file from /username/current/. (You'd probably want a shared configuration anyway if you're already sharing all of the WordPress files.)
I also don't see where you would define ABSPATH to be outside of wp-load.php. In wp-config.php? You're trying to find wp-config.php, that's why we need ABSPATH to begin with. wp-load.php is one of the first files included; there's no place for such a define to go.
ABSPATH cannot be modified directly, and I'd like to keep it that way. It means less mistakes, less weirdness, less unsupported setups.
#9
@
9 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Going to reopen this one. I would like to define ABSPATH
outside of WordPress as well - in my case I would like to define it in something loaded via auto_prepend_file
. It's possible today, but because of the lack of a defined()
check in wp-load.php
we generate PHP Notices. I don't really see any harm in wrapping the ABSPATH
define in wp-load.php
in a if ( !defined('ABSPATH') )
check like it is in wp-config-sample.php
Defining ABSPATH
outside of WordPress in my use case actually leads to less complexity, not more.
#12
@
9 years ago
- Keywords 4.6-early added
- Milestone changed from Awaiting Review to Future Release
I see no problems with this, so long as we do it early to catch any breakage nice and early in the cycle.
ABSPATH at top of wp-admin/admin.php as well