Skip to content

Commit 007f858

Browse files
committed
Custom Media Path
1 parent 2914a90 commit 007f858

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Following standard features of the WordPress Core are manipulated or extended.
3939
* Search
4040
* Site Health
4141
* Update
42+
* Uploads
4243

4344
### Archives
4445

@@ -101,6 +102,10 @@ Following standard features of the WordPress Core are manipulated or extended.
101102
* Run Plugin Updates automaticly
102103
* Run Theme Updates automaticly
103104

105+
###
106+
107+
* Add Subdirectory YEAR for Uploads
108+
104109
## Plugin Modifications
105110

106111
Standard features of the following plugins will be manipulated or extended.
@@ -220,6 +225,7 @@ This project is licensed under the GPL3 License.
220225

221226
Release pending.
222227

228+
* Added: Custom Upload Subdirectories
223229
* Added: TootPress Afterloop Filter
224230
* Added: Caching of ActivityPub Endpoints in WP REST API
225231
* Added: Fade out WB REST CACHE Icon @ Admin Bar

unmus.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
require_once('unmus_visibility.php');
5050
require_once('unmus_cache.php');
5151
require_once('unmus_tootpress.php');
52+
require_once('unmus_ftp.php');
5253

5354
// Ensure that all required functions are available during setup
5455
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');

unmus_ftp.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/**
4+
* FTP
5+
*
6+
* @package unmus
7+
* @since 0.9
8+
*/
9+
10+
function unmus_media_path ( $param ){
11+
12+
$year=date("Y");
13+
$custom_path = '/'.$year;
14+
15+
$param['path'] = $param['path'] . $custom_path;
16+
$param['url'] = $param['url'] . $custom_path;
17+
18+
return $param;
19+
20+
}
21+
add_filter('upload_dir', 'unmus_media_path');
22+
23+
?>

0 commit comments

Comments
 (0)