Have you ever wondered where WordPress stores images on your server? Perhaps you need to access some image files you’ve uploaded in the past, or maybe you want to reorganize your media library.
In either case, it’s helpful to understand exactly how WordPress handles media uploads and attachments.
How WordPress Stores Images
You can upload images to your site by going to
Media > Add New in your WordPress dashboard. You can either drag and drop or click “Select Files” to browse your hard drive.
Alternatively, you can add an image directly to a post by adding an image block and following the same process.
But where do these images end up?
The WordPress Media Library
All of the media files you upload through WordPress can be found at
Media > Library in your dashboard.
This screen provides an intuitive way to manage your media uploads.
When you click on an item, you’ll see some more information about the file, and you can edit various metadata such as the alt text, title, caption, and description:
You can also delete the file by clicking “Delete Permanently.” This is the best way to delete media uploads from WordPress, as it deletes them cleanly without leaving data behind in the database.
Where WordPress Stores Image Files On Your Server
When you upload an image to WordPress, the image file itself (e.g.
image.jpg) will be stored in the
/wp-content/uploads/ directory on your server.
The default behavior is to organize this directory into folders based on upload date
For example, an image uploaded in July 2019 would be stored in
You can access these directories using your cPanel file manager or an FTP client like FileZilla.
How WordPress Stores Images In Your Database
WordPress stores information about your images and other media attachments in multiple locations within your database. You can use phpMyAdmin via cPanel to view and manage this data.
Media Attachment Data
WordPress stores information about the media you’ve attached to posts, pages, and custom post types in the
wp_posts table of your database.
Your images and other media attachments will be labeled
attachment in the
Featured Image Data
WordPress also keeps track of featured images (also known as thumbnails) in the
wp_postmeta table of your database.
In this case, you’re looking for rows with a
How To Properly Delete Images In WordPress
Deleting an image file using an FTP client or the cPanel file manager will remove it from your server, but it will not remove the associated metadata from your database. As a result, the image will still show up on your WordPress site and in your media library as a broken image:
Likewise, deleting image references from your database will remove them from your media library, but the image files themselves will still exist on your server.
The best way to delete an image in WordPress is to simply go to
Media > Library in your dashboard, then use the Delete button for any items you’d like removed. This will simultaneously delete the file from your server while also removing the associated database references.
If for any reason you need to remove an image manually, be sure to delete both the file itself and any references in the database.
How To Change The Way WordPress Organizes Media Uploads
By default, WordPress organizes your media files into month- and year-based folders by upload date.
If you would like to disable this behavior and store all of your media files directly in
/wp-content/uploads/, you can change this setting by going to
Settings > Media in your WordPress dashboard.
From here, simply uncheck the box labeled “Organize my uploads into month- and year-based folders.”
Keep in mind, however, that if your site has a lot of uploads, this directory can become chaotic in no time.
If you want to take full control over your WordPress media folders, you can install the free WordPress Media Library Folders plugin.
We hope this guide has been helpful! If you have any other questions about where WordPress stores images, please leave them in the comments below!