By default, after installing a WordPress website, uploaded images are stored on the server in a year/month format. However, if many images are uploaded in a particular month, along with automatically generated thumbnails, the folder could contain tens of thousands of images, affecting server efficiency. Therefore, we need to customize WordPress's upload path.
Method One: Customizing the WordPress Upload Folder
We can install the Custom Upload Dir Plugin to achieve this. This Plugin allows you to customize the upload path.
You can construct variable paths from elements like Post titles, Categories, Post authors, and publication dates.etc.。
Download LinkMethod Two: Customizing the WordPress Upload Folder
This is a code-based method that doesn't require a Plugin. Insert the following code into your website Theme's functions file to upload to a specified folder.
add_filter('upload_dir', 'awesome_wallpaper_dir');
function awesome_wallpaper_dir( $param ){
$mydir = '/awesome';
$param['path'] = $param['path'] . $mydir;
$param['url'] = $param['url'] . $mydir;
return $param;
}/awesome is the path you set. For details, please refer to: https://codex.wordpress.org/Plugin_API/Filter_Reference/upload_dir
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.