Remove "/site/XYZ/" from permalink on file upload

I desire a global default media path to be set for all current sites (and newly created). Sadly, I don’t have a sub-directory network setup. I was thinking, I could even create a subdomain, and host the entire network images there. When image is upload on XYZ network site, it’s uploaded to: http://media.domain.com/2015/05/downward-arrow.png

If you may, please point me into the right direction, I would be most appreciative.

Currently, when I upload a file this is the permalink:

http://domain.com/files/sites/27/2015/05/downward-arrow.png

How do I make it this:

http://domain.com/files/2015/05/downward-arrow.png

I have a subdirectoy WPMU configuration. I was able to Change Default Media Folder using your blog post – wicked helpful!

  • Sajid
    • DEV MAN’s Sidekick

    Hi @webmaster! Hope you are doing good today and thanks for your question :slight_smile:

    I just again changed the uploads directory by following the steps mentioned in our blog and its working perfectly fine for me. I tested on both test sites Multisite and Single Site.

    Send me FTP and WordPress login details so I can see settings and make changes in wp-config.php file (if necessary). You can send us these details by using our private contact form in following format.

    Subject: “Attn: Sajid Javed

    -WordPress admin username

    -WordPress admin password

    -login url

    -FTP credentials (host/username/password)

    -link back to this thread for reference

    -any other relevant urls

    Select “I have a different question” for your topic – this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Take care and have a great weekend :slight_smile:

    Cheers, Sajid

  • Webmaster
    • Flash Drive

    It works for me as well – it’s practically perfect.

    I was just curious, if, with a subdirectory network, it’s possible to exclude /site/ID/ from the permalink when uploading images. Just let me know if this is possible. It’s not that I don’t trust you, I just want to learn. What code was in your wp-config.php file? This is what’s in my wp-config.php file:

    define('UPLOADS', 'files');

    and I placed that just above the:

    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

  • Sajid
    • DEV MAN’s Sidekick

    Hi @webmaster! You are welcome and welcome back :slight_smile:

    I tested it with main blog and it worked without the site ID. For subsites in subdirectories there must be two folders ‘sites’ and ‘site_ID’ in image path. This is how WP stores images for subsites.

    By doing a quick google search I found this post, it allows you to share your main site images to all of your subsites. May be its something, that may work for you.

    http://wordpress.stackexchange.com/questions/77132/using-same-directory-for-storing-all-uploaded-images-on-a-wordpress-network

    Take care and have great weekend :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.