The WordPress Media Library is where you can add media assets to your site. If you are editing a post, page, or product and adding a featured image, the image will automatically be added to the site's media library. WordPress will accept several kinds of image formats, document file formats, and video formats.
Ideally, if you are planning on trying to upload a large MP4 video file on the site, then the recommendation would be to first optimize the video file.
If possible, use a video hosting service such as YouTube or Vimeo, after which you could embed the video on the page or post on your site using the "embed HTML code" provided by the video hosting service. WordPress, by default, accepts many file formats that can be uploaded to the media library.
Those file formats are covered in the section below.
WordPress Image File Types
Here are the image file types that WordPress supports:
WordPress Document File Types
Here are the document file types that WordPress supports:
- PPT, PPTX, PPS, PPSX
- XLS, XLSX
WordPress Audio File Types
Here are the audio file types that WordPress supports:
WordPress Video File Types
Here are the video file types that WordPress supports:
- MP$, M4V
Adding Media Images Using Media > Add New
To add media images to your site from the wp-admin area, navigate to the Media > Add New option. Then, select the file you want to upload.
The application will return the following status message to show that the file has been uploaded correctly on your site:
Viewing Media Images Using Media > Library
To view images already in the site's media library from the wp-admin area, go to the Media > Library option. Here you can upload new files and manage existing media in the library:
WordPress will store images being used on the site in the Media Library, which will use a database reference and upload the file to the Uploads folder on the site's server.
If you are just getting started with WordPress, then the default image sizes that WordPress would be using are as follow:
- Thumbnail Size would be a maximum width and height of 150 pixels.
- Medium Size would be a maximum width and height of 300 pixels.
- Large Size would be a maximum width and height of 1024 pixels.
- Full Size would be the original size of your image.
WP Media Folder
WordPress by default stores images in the following folder on your site's server:
Changing the upload folder location is possible by adding a constant to your site's wp-config.php file. The following is an example of constant change with regard the Uploads folder to use:
define( 'UPLOADS', 'blog/wp-content/uploads' );
Why Would You Need to Regenerate Images?
The most common reason you would need to regenerate your image thumbnails for your media library on your site would be to add custom image sizes or change the image sizes in your theme for your WooCommerce Store.
Another reason why you would need to regenerate thumbnail images will be if a plugin you are using on the site adds new image sizes, such as a gallery plugin.
WP-CLI (WordPress Command Line Interface) Media Regeneration
WP-CLI makes it easier to regenerate thumbnails without having to install a thumbnail regeneration plugin on your site.
If you have other WordPress-specific questions, then the Nexcess Knowledge Base has you covered.
To regenerate thumbnails, specify attachment IDs (replacing the actual IDs needed), and then use this WP-CLI command:
wp media regenerate 123 124 125
To be able to regenerate all thumbnails for images without confirmation, use this WP-CLI command:
wp media regenerate --yes
To regenerate all thumbnails that have an ID between 1000 and 2000, then use this WP-CLI command:
seq 1000 2000 | xargs wp media regenerate
To be able to only regenerate thumbnails for images with missing image sizes.
wp media regenerate --only-missing
To regenerate the thumbnails for all images of the ‘large’ image size only, use this WP-CLI command:
wp media regenerate --image_size=large
To keep the existing thumbnails which would be by default deleted when they are regenerated then use this WP-CLI command:
wp media regenerate --skip-delete
Regenerating images will help resolve having images not displaying correctly when you change themes or plugins on your site.
Disabling Background Image Generation in WooCommerce
If you are using WooCommerce on your site, since WooCommerce Version 3.3 it includes a background image generation feature that will run if you change themes on your site.
To ensure that the background image generation feature in WooCommerce does not run on your site, you can use this code snippet since you will be regenerating images using a WP-CLI command.
add_filter( 'woocommerce_background_image_regeneration', '__return_false' );
Get Fully Managed WordPress Hosting From Nexcess
If you're on WordPress, consider fully managed WordPress hosting from Nexcess. It's specifically optimized for WordPress, so your site will be speedy, secure, scalable.
Check out our plans to get started today.
WordPress Image FAQs
What are The Best Image Sizes for WordPress?
The optimal image sizes for WordPress vary based on where you want to use them:
- Thumbnail images should be 150 x 150 pixels.
- Blog images should be 1200 x 630 pixels.
- Header images should be 1048 x 250 pixels.
- Featured image should be 1200 x 900 pixels in landscape orientation and 900 x 1200 pixels if in portrait orientation.
- Background images should be 1920 x 1080 pixels.
- Logo images should be 200 x 100 pixels.
How Do You Enhance the Image Quality in WordPress?
By default, WordPress compresses your images by approximately 80% in quality to improve the site loading performance for mobile users. If that causes issues, you can disable image compression or adjust it. You can resize the default thumbnail size and regenerate them using a plugin such as Regenerate Thumbnails.