Multisite – Sub Site – Default Upload Path

Hi Team,

I’m looking for a way to have my multisite always change the upload path to NOT include the blog year and date, I want it to upload direct to the Site/XX/ folder (eg. site/11/file.png)

I know I can manually go into the site settings as a super admin and change the value of “Uploads Use Yearmonth Folders” from 1 to 0, but I don’t want to manually do this every time.

I’m also hoping there is a way to do this without editing core files and/or writing a plugin, I’m hopeful given the feature exists to change, that we can change what the default value is set to easily.

Thanks in advance for your help.

  • Sajid
    • DEV MAN’s Sidekick

    Hi @bmwillrath,

    Hope you are doing good today :slight_smile:

    If you understand correctly you want to disable the year month media structure for new sites by default. If yes then I come up with following code snippet to disable years month structure by default.

    Use it as mu-plugin. Download the file from this github public gist and upload to wp-content/mu-plugins directory (create if not exists).

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

  • Braydan Willrath
    • Flash Drive

    Hey Sajid,

    Thanks for your reply and for the code, I have already researched and found that, sorry if my question wasn’t clear.

    I’m really hoping there is a way to do this/set this as default without using a Plugin of any kind as due to the nature of the platform I’m building, the less plugins and hard modified code, the better.

    Would there perhaps be a way to set this through wp-config.php?


  • Panos
    • SLS

    Hello @bmwillrath,

    Through wp-config.php you can change the Uploads folder, but I am not sure about the Yearmonth folders though.

    You can place the following line in your wp-config in order to change the Uploads:

    define( 'UPLOADS', 'wp-content/your-folder' );
    //define( 'UPLOADS', 'somewhere-outside-wp-content/' );

    This might make any images you have already uploaded inaccessible and if you switch folder again in the future previous images will be inaccessible too.

    Also depending on the privileges in your directories it is possible that WordPress won’t be able to create this folder in your specified location in which case you should create the new upload folder manually through FTP of your cPanel’s file manager. In most cases WordPress handles it without a problem :slight_smile:

    As for Yearmonth option, as I mentioned earlier, I am not aware of any method accomplishing it from your wp-config.php file. The method Sajid suggested is the way to go here in my opinion. Another way this can be done is by adding the following filter that will override wordpress’ settings:

    add_filter( 'option_uploads_use_yearmonth_folders', '__return_false', 100 );

    This always returns false even if you set the option ‘Uploads Use Yearmonth Folders’ to 1. The problem with this in your case is that you will have to create a custom plugin for it. I believe it could be very useful to have a plugin that contains all your customizations.

    Hope this helps a bit :slight_smile:

    Kind regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.