Thursday, March 31, 2016

Where Does WordPress Store Images on Your Site?

Are you wondering where does WordPress store images on your website? Many beginners users have asked us how does WordPress store images and what they can do to organize their media library more effectively. In this article, we will explain how WordPress stores images on your site.


Where does WordPress store images on your site


How Does WordPress Store Images?


WordPress comes with a built-in system to manage your media uploads like images, videos, music, documents, etc. This system allows you to upload, manage, edit, and delete files from your WordPress media library.


Media Library view in WordPress admin area


By default, WordPress stores all your images and media uploads in /wp-content/uploads/ folder on your server. All uploads are organized in a month and year based folders.


For example, all your media files uploaded in in March 2016 will be stored in:


/wp-content/uploads/2016/03/


You can view these folders by connecting to your WordPress site using an FTP client.


FTP view of uploads directory of a WordPress site


WordPress also adds information about your image uploads in the database. Information about your uploads is stored in database as a attachment post type under the posts table.


Database entry for attachment post type as seen in phpMyAdmin


WordPress also saves information in posts meta table when you insert images into posts/pages or any other custom post type.


When you set featured image also known as thumbnails, WordPress saves this information as a meta key _thumbnail_id and stores it in the postmeta table of your database.


Thumbnail ID meta key stored in postmeta table


Deleting your files from server using an FTP client will remove them from your server, but it will not remove them from the WordPress database. Those images will continue to appear on your WordPress site as broken images.


Similarly, if you delete references to your images and media uploads from database, then WordPress will stop showing them in the Media library. Even if all your images are intact and stored on your server.


Changing How WordPress Stores Images and Media Uploads


By default, WordPress does not allow you to change the uploads location from WordPress admin area. The only change you can make is to disable the month and year based folders by visiting Settings » Media page.


Organizing uploads in months and year based folders


Simply uncheck the box next to 'Organize my uploads into month- and year-based folders' option and save your changes. WordPress will start storing your files directly in /wp-content/uploads/ folder.


Advanced WordPress users can use a custom upload directory instead of the default location. See our guide on how to change the default media upload location in WordPress.


Organizing Your Images in WordPress


WordPress does not allow you to use custom folders when uploading your images. This makes it difficult for users to organize their images in a folder based structure.


However, you can use image tagging to organize your WordPress media uploads. WordPress gallery plugins like Envira Gallery make image organization easier with albums and image tags.


We hope this article helped you learn where does WordPress store images on your site. You may also want to see our guide on how to find royalty free images for your WordPress blog.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post Where Does WordPress Store Images on Your Site? appeared first on WPBeginner.

No comments:

Post a Comment