Skip to content

Instantly share code, notes, and snippets.

@webhouse-dev
Last active January 21, 2021 18:47
Show Gist options
  • Save webhouse-dev/25c8ac147518f879c48dce63516db03b to your computer and use it in GitHub Desktop.
Save webhouse-dev/25c8ac147518f879c48dce63516db03b to your computer and use it in GitHub Desktop.
Upload WordPress images to day folders
/**
* @snippet Upload WordPress images to day folders
* @how-to Add to functions.php or get plugin Code Snippets
* @author webhouse.dev
* @url https://webhouse.dev
*/
function upload_dir_filter($uploads){
$day = date('d');
$uploads['path'] .= '/' . $day;
$uploads['url'] .= '/' . $day;
return $uploads;
}
add_filter('upload_dir', 'upload_dir_filter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment