Regenerating images will help resolve having images not displaying correctly when you change themes/plugins on your site, and WP-CLI makes the process easy.
Regenerating WordPress (WP) Images with the WordPress Command Line Interface (WP-CLI)
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.
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.
WordPress Media Library
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 . If possible, use a video hosting service such as YouTube or Vimeo, after which you could using the "embed HTML code" provided by the video hosting service. WordPress, by default, accepts many that can be uploaded to the media library. Those file formats are covered in the section bellow.
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
WordPress Video File Types
Here are the video
- MP$, M4V
Adding Media Images Using Media > Add New
To add media images to your site from the wp-admin area, navigate to the 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:
Media > Library
To view images already in the site's media library from the wp-admin area, go
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' );
Consider Managed Hosting with Nexcess
Nexcess offers solid Managed WordPress hosting, which includes many Nexcess host-specific features such as the Plugin Performance Monitor and an in-house Nexcess Edge CDN. For example, if you are using the WooCommerce Plugin on your site then you would be able to use the WooCommerce Automation Testing feature for your site.
Nexcess also makes it easy to create a staging site to test out changes you want to make to the live site. Using a staging environment is an excellent way to test out new plugins and themes if you are planning on changing those items on your live site.
Image Regeneration Useful Links
Consider Managed WordPress with Nexcess
Any contact form plugin will be of no use to your WordPress site if it is not hosted with a decent hosting company. Here at Nexcess, we provide the best WordPress and WooCommerce hosting, fully optimized for speed and performance.
On top of that, we offer automatic WordPress core and plugin updates, free SSL certificates, and an unsurpassed support team. Additionally, 30-day backups included in every plan will ensure the safety and integrity of your data.
Fulle Managed Hosting Starts with Nexcess
Build Better Sites and Stores With Fully Managed Hosting from Nexcess
Faster Speeds, Stronger Security, Inherent Scalability and Trusted Support.
Our range of hosting plans caters to any business scale. We do all the heavy lifting for you to focus on growing your business. In addition, we automatically update ore components and plugins to the latest version and ensure your hosting environment is properly optimized, secured, and updated.
Nexcess infrastructure was specially designed to keep up the best speed and performance in the industry. No traffic surge can threaten your website to go down thanks to our autoscaling technology which adds more resources to your server to handle the load. In addition, we offer always-on security monitoring and support from web hosting experts 24/7/365 and .
Need a No-Code Website Building Solution?
Are you on an accelerated schedule and already ready to move forward? If you need to get started with your Nexcess StoreBuilder Solution sooner rather than later, check out these resources:
Next Steps with a Nexcess Cloud Hosting Solution?
Read more about the Fully Managed Cloud Environment by Nexcess and its benefits for your business.
A Cloud Hosting Solution That Lets You Do Business Your Way
We believe in the promise of cloud: scalability, security, performance, and ease of use. Together with our team, clients, and partners, we’ve built something better.
Choose From Multiple Applications
Whether you’re a small business or a high-traffic eCommerce store, our cloud hosting solutions are designed around your needs: auto scaling, PCI compliance, and comprehensive development tools provide you with maximum dynamic flexibility in a fully managed cloud environment.
We make applications easy with environment optimizations for:
And there are many more!
We also have a variety of Nexcess support articles about how best to implement our product offerings housed in the Nexcess Knowledge Base, including how to get your site going with a number of different configuration options. These resources include a great article on setting this up for Migrating to Nexcess with managed WordPress and managed WooCommerce hosting.
If you need any assistance with the above-mentioned, don't hesitate to reach out. For 24-hour assistance any day of the year, Nexcess customers can contact our support team by email or through your Client Portal.
Why Choose Nexcess?
Because we're different! Chris Lema captures "the why" in his passionate and stirring recount of a Nexcess support-related story.
Resources for More Information
New Customers: Fully Managed Hosting Solutions
- How to Enable Auto-Updates for Plugins and Themes (via the user interface)
- Nexcess WordPress Plugins and Their Configurations
- How to Deactivate all Plugins and Change the Active Theme Using phpMyAdmin
- How to Update Plugins on your WordPress Site
Updating WordPress Plugins Individually for Admins
- How to Disable WordPress Core Updates