Forums

[resolved] uploading plugin creates directory in wrong location (11 posts)

  1. joeyconnick
    Member
    Posted 3 years ago #

    Background: I initially had WordPress installed in my /blog directory. I then moved it to root, deleted the actual /blog directory, and configured the installation so root displays a static page and /blog is where the actual blog is found.

    Now, whenever I upload and install a plugin to WordPress, the directory "/blog/wp-content/uploads" gets created in the site root, which of course screws up the setup described above (the blog does not show at /blog I assume because WordPress expects to handle requests to /blog dynamically but gets screwed up by the fact that the /blog directory now exists). The fix for this is to go and delete /blog and all its contents.

    I assume this is an artifact of me moving the blog from /blog to root and forgetting a step or something. Is there some way I can correct this? Otherwise the site is working fine. I found a setting in the wp_settings table called upload_path that I changed from "/root/blog/wp-content/uploads" to "/root/wp-content/uploads" but this does not seem to have fixed the issue.

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    'upload_path' is a result of the Store uploads in this folder setting in Administration > Settings > Miscellaneous. Do you have anything in the Full URL path to files in that screen?

    Also, I don't understand why you would even have a blog subdirectory under your web-root folder...

  3. joeyconnick
    Member
    Posted 3 years ago #

    Nope, Full URL path to files is blank.

    I don't have a blog subdiretory under my web-root folder; WordPress does keep creating one there when I try to install plugins, though.

    What I do have is a page in WordPress called "Blog" with Permalink "http://www.mydomain.com/blog/" and then I have, under Administration > Settings > Reading, Posts page set to "Blog"

    This lets me use another page as my "Front page" and have my blog show up at "http://www.mydomain.com/blog/"

  4. MichaelH
    Volunteer
    Posted 3 years ago #

    Hmm. Your Miscellaneous settings Store uploads in this folder would only need to be wp-content/uploads, correct?

  5. joeyconnick
    Member
    Posted 3 years ago #

    That's right... Miscellaneous Store uploads in this folder is set to "wp-content/uploads"

    It's just that somewhere WordPress thinks it's installed at mydomain.com/blog (but it's not) which would explain the ongoing creation of mydomain.com/blog/wp-content/uploads.

  6. MichaelH
    Volunteer
    Posted 3 years ago #

    So you don't even have a blog folder in your web-root folder, but the plugin install process creates blog, blog/wp-content, and blog/wp-content/plugins folders?

    If I'm reading it right, it gets a value for WordPress Address URL in Settings->General from a row called siteurl in the wp_options table. I have to guess that value is correct or your blog wouldn't work.

    It tries to use the siteurl value along with the upload_path value from wp_options table. Or it uses the upload_url_path value from wp_options. But you checked both those values--one is "wp-content/uploads" and the other is blank. Might make sure upload_url_path is not in wp_options table or has no value in wp_options.

    It also tries to use the variables WP_CONTENT_DIR, and WP_CONTENT_URL. Those could be set in your wp-config.php file. But I'm guessing that you don't have those in wp-config.php or you'd be having other problems.

    Also it tries to use a variable called UPLOADS but it seems that value could only come from wp-config.php, or it is getting defined by another program.

    Leading me to wonder if a plugin is the culprit?

  7. joeyconnick
    Member
    Posted 3 years ago #

    I think I know what it is... and your comments helped.

    It was something that occurred to me might be happening but then I thought... "Nah!"

    Because the blog is installed in root but is dynamically appearing at mydomain.com/blog, I have the Permalinks set to a custom value of "/blog/%year%/%monthnum%/%day%/%postname%/"

    I just searched through wp-options for a value LIKE %upload% and one of them is uploads_use_yearmonth_folders, which is set to 1. I assume this is the source of the mysterious creation of the blog folder and I assume if I set it to 0, wp-content/uploads will show up where it's supposed (under root).

  8. MichaelH
    Volunteer
    Posted 3 years ago #

    That uploads_use_yearmonth_folders is from the Miscellaneous Setting, Organize my uploads into month- and year-based folders , so it is set to a value if 1 if you want the uploads placed in date/month subfolders under the uploads folder.

    Don't really see that being the problem--same goes for your permalink structure.

    What was your answer to this question?

    So you don't even have a blog folder in your web-root folder, but the plugin install process creates blog, blog/wp-content, and blog/wp-content/plugins folders?

  9. joeyconnick
    Member
    Posted 3 years ago #

    Well I didn't really see it as the problem either, but when I unselected the option, the plugin upload and install process stopped creating the blog folder.

    My answer to the question is YES: I didn't even have a blog folder in the web-root, but the plugin install process (any plugin) creates blog, blog/wp-content, and blog/wp-content/plugins folders... plus folders under that last one that seemed weird but then I realized they were year/month/day folders.

    So while it doesn't seem like the uploads folder should have anything to do with the Permalinks setting, it seems like it does... which would make a certain amount of sense in that the directories under the strangely-created /blog included date folders.

  10. MichaelH
    Volunteer
    Posted 3 years ago #

    Thanks for the feedback j!

    I'll remember this one for a while ;)

  11. gionn
    Member
    Posted 2 years ago #

    This is not a bug but a "feature":
    http://core.trac.wordpress.org/ticket/10752

Topic Closed

This topic has been closed to new replies.

About this Topic