Skip to content

Instantly share code, notes, and snippets.

@sjaved87
Created March 27, 2016 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjaved87/320a2bc984909c584eac to your computer and use it in GitHub Desktop.
Save sjaved87/320a2bc984909c584eac to your computer and use it in GitHub Desktop.
This small snippet will disable the use of year month format to store media on signup.
<?php
function wpmudev_set_default_media_settings( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
update_blog_option( $blog_id, $option = 'uploads_use_yearmonth_folders', $value = 0, $deprecated );
}
add_action( 'wpmu_new_blog', 'wpmudev_set_default_media_settings',10, 6 );
@jockebq
Copy link

jockebq commented Mar 12, 2019

Don't you need to do switch_to_blog($blog_id); and restore_current_blog(); before and after this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment