Have you ever wondered where WordPress stores images on your server? Maybe you need access to some image files you've uploaded in the past, or you might want to reorganize your media library. All uploads are organized into folders based on a month and a year, which can be accessed through an FTP client such as FileZilla. Additionally, WordPress stores information about your images and other multimedia attachments in multiple locations within your database. The default behavior is to organize the directory into folders based on the upload date.
You can view these folders by connecting to your WordPress site using an FTP client. Alternatively, you can add an image directly to a publication by adding an image block and following the same process. This screen provides an intuitive way to manage media uploads. WordPress stores information about the media you have attached to publications, pages and types of custom publications in the wp_posts table in your database.
Images and other multimedia attachments will be labeled as attachments in the post_type column. WordPress also keeps track of featured images (also known as thumbnails) in the wp_postmeta table in your database. In this case, it searches for rows with a meta_key of _thumbnail_id. Deleting image references from the database will delete them from the media library, but the image files will still exist on the server. If for some reason you need to delete an image manually, be sure to delete both the file and any references from the database.
If you want to have full control of your WordPress media folders, you can install the free WordPress media library folder plugin. This plugin allows you to create custom folders and organize your media files into them. You can also tag graphics that you upload to WordPress with keywords that you can then use as search criteria. By default, WordPress organizes your media files into folders based on months and years based on the upload date. From here, simply uncheck the box “Organize my uploads into folders based on months and years” if you want to change this behavior. Any image files you upload are also stored in your site's database.
You can see them in the Publications table as attachments. With SFTP, you can connect directly to your WordPress site using special software called an FTP client. And if some of those media files are added to pages, publications, or custom publication types, WordPress will also store their metadata inside the wp_postmeta table. As you have seen, the uploaded images are stored inside the uploads folder, while their data is stored inside your database, in the wp_posts and wp_postsmeta tables. The multimedia library of WordPress is practically what its name sounds like: it is the place where you can store and organize all the media that you upload to your site. Note that if you changed the default prefix of the WordPress database (wp_), your tables will have slightly different names.
Learning more about this topic will help both users and site owners get the most out of their images.