WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] WordPress 3.5 > where the option settings->media->upload_path gone !? (20 posts)

  1. Elan42.com
    Member
    Posted 1 year ago #

    Hi guys ...

    I have 53 websites done in WP,
    all of them use custom upload_path because I use one single directory/installation for all of them.

    Now, where is the "settings->media->upload_path" option gone in 3.5 ?

    I really hope you didn't choose to remove this configuration option for future versions, and please, if you did give me an alternative ...

    For example, creating a new define in the wp-config would be good.
    Something like:
    define('WP_UPLOAD_PATH', '***');

  2. It has been removed.

    These can be set on options.php, or the UPLOADS constant or the filters in wp_upload_dir() should be used.

    See https://core.trac.wordpress.org/changeset/21852

  3. Elan42.com
    Member
    Posted 1 year ago #

    Excuse me, but I really don't understand this choice.
    Why hard-coding options is better than leaving people free to decide ?
    It seems like a step behind to me.

    Expecially because oblying me to edit "wp-admin/options.php" is the opposite of "avoid UI options that require filesystem changes", that was indeed the reason for this change in 3.5.

    Plus, why you removed this option from the admin whithout adding a "define" in wp-config like:
    define('WP_UPLOAD_PATH', '***');
    that could have resolved both problems ?

    I don't understand the explanations of the link you gave me, maybe I am wrong and a way to change the UPLOADS costant do exist ?
    In this case, can someone update the wiki ?:
    http://codex.wordpress.org/Editing_wp-config.php

  4. Excuse me, but I really don't understand this choice.
    Why hard-coding options is better than leaving people free to decide ?
    It seems like a step behind to me.

    There is nothing hard-coded. It's the same as before, just the UI is gone. The reason was mentioned in the commit:
    "WordPress should aim to avoid UI options that require filesystem changes as well, not to mention requiring the user to convert between paths and URLs."

    Plus, why you removed this option from the admin whithout adding a "define" in wp-config like:

    If we would to this for each constant the config would be to confusing for new users.

    I don't understand the explanations of the link you gave me, maybe I am wrong and a way to change the UPLOADS costant do exist ?

    See http://codex.wordpress.org/Function_Reference/wp_upload_dir

    "If the 'UPLOADS' constant is defined, then it will override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path."

    So your define('WP_UPLOAD_PATH', '***');is define('UPLOADS', '***');

  5. Elan42.com
    Member
    Posted 1 year ago #

    Perfect, thank you very much. I mizunderstood your first explanation.

    So a solution exist by the way ... and I'm one of the lucky administrators that found it BEFORE updating.

    I still find this removal very dangerous for all the other users/webmasters that will NOT see this huge modification of WP behaviour, and will find again their wp-content/upload dir filled of files already linked in their customers posts/pages with unwanted URLs.

    That's a very hard thing to rollback. So I'm lucky that I noticed this.

    Think about it next time, because this option has been in WordPress for years, and some "deprecated" alarm should have been given to the users before removing it.

    This of course, IMHO.

  6. The UI will be only removed if the setting is empty or the same as the default wp-content/uploads. When you have changed the setting it will be still displayed.

  7. Elan42.com
    Member
    Posted 1 year ago #

    Well I need to fix this also for new installations ...
    ... so I think I'll just use the define in the future. (or find a way to force-insert this option in new WP installations trought mysql query).

    I'll actually set/force theme folder, file upload folder, as the table_prefix of all the websites.

    Thanks

  8. zabatonni
    Member
    Posted 1 year ago #

    i found another solution, based on checking get_option('upload_path')
    put this code in your functions.php of your theme

    if(get_option('upload_path')=='wp-content/uploads' || get_option('upload_path')==null) {
    update_option('upload_path',WP_CONTENT_DIR.'/uploads');
    }

    and your settings are back

  9. Elan42.com
    Member
    Posted 1 year ago #

    @zabatonni can your solution be dome also in wp-config? or it's too early for update_option() calls ?

    my solution was this, in wp_config:

    define('UPLOADS', "files/".$table_prefix);

    But it doesn't check if this option is already set. However in all my websites my wp_upload dir was the table prefix.

    Now: I could change my solution for yours, the question is, will WP forever care about upload_path in the database ? Or it will be deprecated one day ?

  10. zabatonni
    Member
    Posted 1 year ago #

    it only uses get_option and update_option so it will work till they decide to remove those functions.

    The benefit of this is that when you set your folders you can remove function and it will be still showing options in admin page.

    those options will disappear only when you set path to blank or wp-content/uploads.

    and thats exactly what my solution does. checks whether it is blank or default and then set to default in full path way.

    about using it in wp-config im not sure, but you can try and let me know.

  11. Elan42.com
    Member
    Posted 1 year ago #

    No it don't work in wp-config: undefined function get_option()

    I understood your solution, I was just saying that I don't know for how many time WP developers will look at this upload_path in the database, until it gets deprecated.

    I think I will use your solution, but editing all my functions.php will be tough.

    But I have a question, can I get table_prefix from within a WP theme? I don't think so ... because it could be a security leak, isn't it ? So I'll have to create a function that GUESS it ...

  12. zabatonni
    Member
    Posted 1 year ago #

    in my opinion it wont be deprecated because there is that option in multisite installation..

  13. Elan42.com
    Member
    Posted 1 year ago #

    Honestly I still did not understand why they removed it in the first place ... users can still change it editing themes with YOUR solution, or administrators can still change it with MY solution.

    So in the end nothing changed, it's just harder to configure WordPress now because there is one less option.

  14. zabatonni
    Member
    Posted 1 year ago #

    is there a way to set uploads to for example uploads.domain.tld
    i can set it directly in database and it works but in wp-config with define('upload') it seems that it has to be in wp install folder but with different name..

  15. 20pips
    Member
    Posted 1 year ago #

    yeap I am with you...

    removing such a basic facility, just because someone decided they should is why the world is such a mess.. Just because you can doesnt mean you should..

    I wasted 2 hours today trying to figure out what was going on..

    they gave us some new things, and took other object away..

  16. purrdesign
    Member
    Posted 1 year ago #

    I'm chiming in that I'm frustrated with these options going away. I often create staging/development sites for my clients (in a subdomain/directory), but still link the uploads folder to their existing uploads (to avoid having to duplicate the entire uploads folder). Seems that is no longer an option for me.

    Using the define('UPLOADS') only seems to work for relative paths, and I just wanted to change the name of the uploads folder that'd be fine. But I cannot seem to point this to an absolute path on the server outside the site directory (such as /home/user/public_html/...) as I used to.

    I can't quite seem to wrap my head around the wp_upload_dir function, and zabatonni's code above gives me a similar "undefined function get_option()" error.

    Anyone have a straightforward solution?

  17. Elan42.com
    Member
    Posted 1 year ago #

    The "undefined function get_option()" error means your running that code too early, you have to run it AFTER WP engine loaded, so in functions.php inside the theme, for example.

    I personally made a MUST USE plugin with zabatonni code inside and put it in all websites, so when I install new WP websites this option appear again and I can change it.

  18. purrdesign
    Member
    Posted 1 year ago #

    Ah, got it. I was putting it in the wp-config.php file.

    Thanks!

  19. Grimpond
    Member
    Posted 1 year ago #

    I would like to add that I also think this is a strange step backward in functionality.

    I do not understand why there is a belief that...

    "WordPress should aim to avoid UI options that require filesystem changes as well, not to mention requiring the user to convert between paths and URLs."

    If people want to hamstring WordPress.. they should make a "lite" version for newbies. Simplifying things for those that have less understanding is not a step forward.

  20. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    WordPress 3.5 (let alone WordPress 3.4) is no longer in beta. Closing topic.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.