Opened 9 years ago
Closed 8 years ago
#35151 closed enhancement (wontfix)
New constant `WP_CONTENT_DIR_NAME`
Reported by: | sebastian.pisula | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch 2nd-opinion close |
Focuses: | Cc: |
Description
If I want change wp-content to other name I must defined three constants:
WP_CONTENT_DIR
WP_SITEURL
WP_CONTENT_URL
This is not flexible because I can't change url in page settings. I suggest add const: WP_CONTENT_DIR_NAME with name of new name.
I define WP_CONTENT_DIR_NAME with new name and is automatically set. I add path
Attachments (1)
Change History (8)
This ticket was mentioned in Slack in #core by sebastian.pisula. View the logs.
9 years ago
#3
@
9 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
#4
@
8 years ago
- Resolution wontfix deleted
- Status changed from closed to reopened
I think that this will be helpful constant. I use wp cli to install website:
core config: dbprefix: wp_ extra-php: | define('WP_DEBUG', 1); define('WP_DEBUG_LOG', 1); define('WP_DEBUG_DISPLAY', 0); define('WP_CONTENT_DIR_NAME', 'my-wp-content');
So I want change WP_CONTENT_DIR I must change WP_CONTENT_URL. And I must define in wp-config.php WP_SITEURL AND WP_HOMEURL but I want get value from option no defined in wp-config.php
For example:
- staging version is on url http://staging.domain.com/
- 1 of 3 developer work on http://domain.com/
- 2 of 3 developer work on http://localhost:1234/company/domain.com/
- 2 of 3 developer work on http://localhost/domain.com/
- production url is http://domain.com/
So I must configure in each env WP_CONTENT_URL because is bad. If I defined WP_CONTENT_DIR_NAME
I don't must change WP_CONTENT_URL because this url will be generate automatic. Then I can use WP-CLI and others automatic apps.
My patch don't destroy nothing but it helps programmer to work
This ticket was mentioned in Slack in #core by sebastian.pisula. View the logs.
8 years ago
#7
@
8 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from reopened to closed
I agree with @dd32 that the common use case of WP_CONTENT_DIR
and WP_CONTENT_URL
is to move the content directory rather than just rename it (usually to keep WP in it's own directory to be pulled in as an external). I'm honestly not sure what the benefit would be of renaming it where it sits.
Having said all that, you can define these constants in a way that works as you push from dev to staging to live. I often use separate config files for those environments, but if you want to keep them all the same, try something like this:
define( 'WP_CONTENT_DIR', __DIR__ . '/content' ); define( 'WP_CONTENT_URL', 'https://' . $_SERVER['HTTP_HOST'] . '/content' );
I really don't think we need another constant here.
To clarify, only
WP_CONTENT_DIR
andWP_CONTENT_URL
need to be defined.WP_SITEURL
is unrelated.The primary use of these constants isn't to rename the folder, it's to support subdirectory installations with WordPress as an external.
For example, in the below scenario we've got WordPress installed into a subdirectory with it's wp-content directory, however we're overriding it and using the one in the parent directory instead.