$0.00

    No products in the cart.

    HomeBlogWeb DevelopmentHow to change default image path in Wordpress

    How to change default image path in WordPress

    Date:

    In this guide, we will walk you through the process of changing the default image path(url) in wordpress. This is useful, particularly for those who wish to have more control over media file organization and URL structure. The process is described in a step-by-step manner, making it easy to follow, even for those without a technical background.

    Why Change Default Image Path in WordPress?

    By default, all images and other media files are stored in the the folder “/wp-content/uploads/”. In this folder, you’ll find further categorization with subdirectories for each year and month. To give an example, any file uploads that happened in April of 2024 would be located at https://websitedomain.com/wp-content/uploads/2024/04/.

    Default Image Folder in WordPress

    Obviously, some people would like me, dislike to keep the date of upload along with image URLs, it reveals that your website is WordPress-built or that your images were uploaded a while ago, you’d want to remove this.

    1. Change Media Upload Settings

    To remove the months and days from image URL, go to “Settings” and click on “Media”. Here, uncheck the “Organize my uploads into month- and year- based folders” box and save your changes. This way, the images will be uploaded directly to the “wp-content/uploads” directory.

    Change Default Image Path in WordPress

    2. Create a New Media Upload Folder and Edit “wp-config.php”

    If you want to replace “wp-content/uploads” with a desired folder, create a folder in the root directory of website. The process is the same across local and live servers. On live servers, locate the root directory (named “public_html” on many hosts), and create a new folder there.
    For instance, you can create a folder named “images”. You could give it any names you want, depending on your preference. Once the new folder is created, navigate to “wp-config.php” file in the root of WordPress installation folder.
    Edit “wp-config.php” file to add the following line of code:

    define(‘UPLOADS’, ”.’images’);

    Upon saving the changes, all newly uploaded images will get stored in the “images” folder directly. The image URL structure will now be “websitedomain.com/images/imagefilename”.

    Just remember, the change is retroactive. All images uploaded from then on will follow the new structure, leaving old uploads in the existing folder with the original URLs.

    In general, changing the default WordPress images path is a simple process that can offer better control and organization of the media files.

    Explore more articles related to WordPress Development.

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here

    Book a 1-on-1
    Talk Session

    Want TechDoDo's full attention? Nothing compares with a live one on one strategy talk! You can express all your concerns and get the best and most straight forward learning experience.

    Related Articles

    Latest Courses

    Tech Do Do

    Tech Do Do