Do you want to change the default media upload location in WordPress?
Moving media files to other folders can improve website speed and performance and help you create backups faster. It also gives you the freedom to organize your files in the way that suits you best.
In this article, we will show you how to change the default media upload location in WordPress.

Why change the default media upload location?
By default, WordPress stores all images and other media files in the /wp-content/uploads/ folder.
In this folder, you will find subfolders for different years and months. For example, all files you uploaded in January 2023 will be stored in https://example.com/wp-content/uploads/2023/01/.

This default structure works for most WordPress blogs and websites. However, sometimes you may want to change the location where WordPress stores files. For example, you can host images on a subdomain because this can improve your WordPress performance.
Moving media files to other folders can also help you create backups faster.
That being said, let's take a look at how to gradually change the default media upload location in WordPress.
Change the default media upload location in WordPress
To change the media directory, you need to add code snippets to your WordPress website. That is, you may need to create a backup of your website before making any changes.
Once done, you need to connect to your site using an FTP client such as FileZilla. If you haven't used FTP before, please refer to our beginner's guide on how to upload files to WordPress using FTP.
After connecting with FTP, simply create a new folder to store the media files. Make a note of the exact folder name, as you will need it in the next step.
Next, you need to add code snippets to WordPress. Typically, WordPress tutorials will ask you to add custom code to the theme's functions.php file.
The biggest problem is that even a tiny bug in a custom code snippet can break your WordPress website and even make it inaccessible. Also, the next time you update your WordPress theme, you will lose all your custom code.
Therefore, we recommend using WPCode. WPCode is the most popular code snippet plugin that allows you to add custom CSS, PHP, HTML, and more without putting your WordPress website at risk.
The first thing you need to do is install and activate the free WPCode plugin on your website. For more details, see our step-by-step guide on how to install WordPress plug-ins.
Once activated, go to Code Snippets in the WordPress dashboard » Add Snippets.
On this screen, hover over Add your own custom code snippet and click it when Use code snippet appears.

First, enter the title of the code snippet. This is for your reference only, so you can use whatever you want.
When finished, open the Code Type drop-down list and select PHP Fragment.

You can now paste the following into the code editor:

When you are done, scroll to the top of the screen and click the Inactive switch to make it appear Active.
You can then go ahead and click Save Fragment to make the code take effect.

Now that you have changed the media upload location, you may want to change how the files are organized in this new folder.
By default, WordPress stores all media files in month and year folders. If you want all files to be saved in the same folder, go to Settings » Media .
You can now uncheck the "Organize my uploads..." box and click "Save changes".

WordPress now uploads all your media files to the same folder. To view these files, simply connect to your site using the FTP client and open the folder of your choice.
For more information on troubleshooting WordPress upload issues, see our guide on how to fix common image problems in WordPress.
We hope this article helps you change the default media upload location in WordPress. You may also want to check out our guide for the most common WordPress errors and how to fix them, as well as the best SEO plugins and tools you should use.
The above is the detailed content of How to change the default media upload location in WordPress. For more information, please follow other related articles on the PHP Chinese website!
How to easily move your blog from WordPress.com to WordPress.orgApr 18, 2025 am 11:33 AMDo you want to move your blog from WordPress.com to WordPress.org? Many beginners start with WordPress.com but quickly realize their limitations and want to switch to the self-hosted WordPress.org platform. In this step-by-step guide, we will show you how to properly move your blog from WordPress.com to WordPress.org. Why migrate from WordPress.com to WordPress.org? WordPress.com allows anyone to create an account
How to Automate WordPress and Social Media with IFTTT (and more)Apr 18, 2025 am 11:27 AMAre you looking for ways to automate your WordPress website and social media accounts? With automation, you will be able to automatically share your WordPress blog posts or updates on Facebook, Twitter, LinkedIn, Instagram and more. In this article, we will show you how to easily automate WordPress and social media using IFTTT, Zapier, and Uncanny Automator. Why Automate WordPress and Social Media? Automate your WordPre
How to Fix Custom Menu Item Limits in WordPressApr 18, 2025 am 11:18 AMJust a few days ago, one of our users reported an unusual problem. The problem is that he reaches the limit of custom menu items. Any content he saves after reaching the menu item limit will not be saved at all. We've never heard of this issue, so we decided to give it a try on our local installation. More than 200 menu items were created and saved. The effect is very good. Move 100 items to the drop-down list and save them very well. Then we knew it had to do with the server. After further research, it seems that many others have encountered the same problem. After digging deeper, we found a trac ticket ( #14134 ) that highlighted this issue. Read very
How to add custom metafields to custom classification in WordPressApr 18, 2025 am 11:11 AMDo you need to add custom metafields to custom taxonomy in WordPress? Custom taxonomy allows you to organize content besides categories and tags. Sometimes it is useful to add other fields to describe them. In this article, we will show you how to add other metafields to the taxonomy they create. When should custom metafields be added to custom taxonomy? When you create new content on your WordPress site, you can organize it using two default taxonomy (category and tag). Some websites benefit from the use of custom taxonomy. These allow you to sort content in other ways. For example,
How to Remotely Publish to WordPress using Windows Live WriterApr 18, 2025 am 11:02 AMWindows live writer is a versatile tool that allows you to post posts directly from your desktop to your WordPress blog. This means you don't need to log in to the WordPress admin panel to update your blog at all. In this tutorial, I will show you how to enable desktop publishing for your WordPress blog using Windows Live Writer. How to set up Windows Live Writer on WordPress Step 1: To use Windows Live Writer in WordPr
How to Fix White Text and Missing Buttons in WordPress Visual EditorApr 18, 2025 am 10:52 AMRecently, one of our users reported a very strange installation problem. When writing a post, they can’t see anything they write. Because the text in the post editor is white. What's more, all the visual editor buttons are missing, and the ability to switch from visual to HTML doesn't work either. In this article, we will show you how to fix the white text and missing button issues in the WordPress visual editor. Be a Beginner Note: If you are looking for hidden buttons that may be seen in screenshots of other websites, you may be looking for a kitchen sink. You have to click on the kitchen sink icon to see other options such as underline, copy from word, etc.
How to display avatar in user email in WordPressApr 18, 2025 am 10:51 AMDo you want to display avatars in user emails in WordPress? Gravatar is a network service that connects a user's email address to an online avatar. WordPress automatically displays visitors’ profile pictures in the comments section, but you may also want to add them to other areas of the site. In this article, we will show you how to display avatars in user emails in WordPress. What is Gravatar and why should I display it? Gravatar stands for globally recognized avatars, which allows people to link images to their email addresses. If the website supports
How to change the default media upload location in WordPressApr 18, 2025 am 10:47 AMDo you want to change the default media upload location in WordPress? Moving media files to other folders can improve website speed and performance and help you create backups faster. It also gives you the freedom to organize your files in the way that suits you best. In this article, we will show you how to change the default media upload location in WordPress. Why change the default media upload location? By default, WordPress stores all images and other media files in the /wp-content/uploads/ folder. In this folder you will find children of different years and months


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6
Visual web development tools







