I have a custom Wordpress file-structure like
web-root:
content (folder)
- uploads (folder)
- plugins (folder)
- themes (folder) ... and so on
wordpress (folder)
- wp-admin (folder)
- wp-includes (folder) ... more folders
- wp-blog-header.php
- wp-load.php
- wp-login.php ... and all other wp core files
.htaccess
index.php
wp-config.php
In my wp-config.php
I have to define the path to my custom uploads folder like this:
if (!defined('UPLOADS')) {
define('UPLOADS', '../content/uploads');
}
More or less out of nothing (maybe I updated the wp core) when trying to upload an image I get the error message saying: can't create folder check if parent folder is writeable.
BUT: if I put the same code into the wp-blog-header.php file uploading and building new folders within the upload folder works.
I thought using DEFINE
(in my case) means that I just save a string value to a constant and where ever I use the constant the value is the same. But how can it be that there is a difference when defining a constant in wp-config.php or wp-blog-header.php? (which is inside the subfolder wordpress
.
For my changes in wp-blog-header.php would disappear after the next Wordpress update I obviously can't solve it that way.
Any ideas what the problem could be?
I have a custom Wordpress file-structure like
web-root:
content (folder)
- uploads (folder)
- plugins (folder)
- themes (folder) ... and so on
wordpress (folder)
- wp-admin (folder)
- wp-includes (folder) ... more folders
- wp-blog-header.php
- wp-load.php
- wp-login.php ... and all other wp core files
.htaccess
index.php
wp-config.php
In my wp-config.php
I have to define the path to my custom uploads folder like this:
if (!defined('UPLOADS')) {
define('UPLOADS', '../content/uploads');
}
More or less out of nothing (maybe I updated the wp core) when trying to upload an image I get the error message saying: can't create folder check if parent folder is writeable.
BUT: if I put the same code into the wp-blog-header.php file uploading and building new folders within the upload folder works.
I thought using DEFINE
(in my case) means that I just save a string value to a constant and where ever I use the constant the value is the same. But how can it be that there is a difference when defining a constant in wp-config.php or wp-blog-header.php? (which is inside the subfolder wordpress
.
For my changes in wp-blog-header.php would disappear after the next Wordpress update I obviously can't solve it that way.
Any ideas what the problem could be?
Share Improve this question edited Nov 7, 2019 at 10:51 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Nov 7, 2019 at 10:36 LuckyfellaLuckyfella 5343 silver badges12 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0(Converting my comment to an answer.)
Since you store themes and plugins in that folder as well, try setting the WP_CONTENT_DIR
constant instead. (Always prefer absolute paths when possible.)
As to your specific case, why it worked in one file but not in another - this will probably involve more debugging, checking where exactly WP uses which constant, etc. If setting WP_CONTENT_DIR
solves your problem, remove UPLOADS
and work with it.
WP_CONTENT_DIR
? – kero Commented Nov 7, 2019 at 11:05