🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

How to set up the image upload folder for a self-built WordPress website

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. WordPress自定义上传路径 Download Link

Method 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

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step instead.

「Naibabiji WordPress Website Building Coaching」 — From selecting a domain and purchasing hosting to installing themes and publishing posts, I「ll guide you through every step, helping you avoid detours and reach your goals directly.

👉 Learn about Website Building Coaching Service
🔒

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.

×
二维码

Scan to Follow