Make WordPress Core

Opened 2 years ago

Closed 15 months ago

#26592 closed feature request (invalid)

Allow ABSPATH to be set outside of wp-load.php

Reported by: jeichorn Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Bootstrap/Load Keywords:
Focuses: Cc:


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.

Change History (8)

#1 @joshua.strebel
2 years ago

ABSPATH at top of wp-admin/admin.php as well

#2 @dd32
2 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 @jeichorn
2 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

#5 @nacin
23 months ago

  • Component changed from General to Bootstrap/Load

#6 @SergeyBiryukov
21 months ago

  • Version changed from trunk to 3.8

#7 @SergeyBiryukov
15 months ago

#29626 was marked as a duplicate.

#8 @nacin
15 months 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.

Note: See TracTickets for help on using tickets.