WordPress in its own subfolder and custom uploads dir name bug
-
Hello,
tl:dr
When running WordPress from a subfolder I am unable to set a custom uploads directorySituation
Currently I am running 3 websites that all will be having the same codebase.
They are 3 language versions and die to our current setup and experience, do not want to use a multi site setup.In our project we setup WordPress in its own folder in de the root just like the official documentation online detailed.
The issue comes when we want to create 3 separate folders for all 3 websites but it seems that WordPress can not get this right.
What I found out
When looking to create the custom folders I found that just usingdefine('UPLOADS' , 'wp-content/media/com')
.
In the media page I can upload an image but it would create the upload directory inside the WordPress subfolder.After some debugging and searching through the source code I found that in no situation the “WP_CONTENT_DIR” or “WP_CONTENT_URL” were added to the “UPLOADS” path.
Every time I found the “UPLOADS” const I would see it being paired with “ABSPATH” and “$siteurl”.This means that all things uploaded go to “https://www.example.com/wordpress/wp-content/media/com”.
But when I leave the “UPLOADS” const empty, or at least don’t define it myself, images are uploaded to the correct location at “https://www.example.com/wp-content/uploads/2022/05”
Notice that it is not going to the WordPress subfolder.Current workaround
Currently I have create a symlink from the “/wp-content/media/com” to “/wordpress/media/com” folder.
This seems the work ok but I don’t think this intended to be set up like this.I saw on multiple occasions that the “WP_CONTENT_DIR” or “WP_CONTENT_URL” were checked if defined before using it for certain tasks related to media.
But no such thing happened with the “UPLOADS” const.Source
The reason I come to this possible conclusion is from the file “wp-includes/functions.php” on line 2406.Hope somebody can tell me if this is a bug/not implemented feature or I am missing something.
Cheers
- The topic ‘WordPress in its own subfolder and custom uploads dir name bug’ is closed to new replies.