We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.
left to get 75% OFF Nexcess premium managed hosting
Shop plans
Contact Us
Contact Us
Sign in
Sign in
Nexcess Logo

WP Images: Regenerating WordPress Images with WP-CLI

May 12, 2022

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.

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.

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 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 bellow.

WordPress Image File Types

Here are the image file types that WordPress supports:

  • JPG
  • JPEG
  • PNG
  • GIF
  • WEBP
  • ICO

WordPress Document File Types 

Here are the document file types that WordPress supports: 

  • PDF
  • ODT
  • PSD

WordPress Audio File Types

Here are the audio file types that WordPress supports:  

  • MP3
  • M4A
  • OGG
  • WAV

WordPress Video File Types

Here are the video file types that WordPress supports:   

  • MP$, M4V
  • MOV
  • WMV
  • AVI
  • MPG
  • OGV
  • 3GP
  • 3G2

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:

Upload New Media screen

The application will return the following status message to show that the file has been uploaded correctly on your site:

status message to show that the file has been uploaded correctly

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:

Media Library screen

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 questionsthen 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

About Nexcess Web Hosting Solutions

A Suite of Solutions Where Better is Built In

Nexcess Hosting is a world-class web hosting platform with integrated managed services built right in! Even though there are services like Flexible Cloud Hosting and Enterprise Hosting, the flagship offerings are Managed WordPress Hosting, Managed Magento Hosting, and Managed WooCommerce Hosting

Nexcess is considered as 1 of the Top 5 Best Web Hosting Providers Perfectly Tailored for Your WebsiteAt Nexcess, we have our own portal and panels to manage your premium hosting and features, making it simple for you to control the hosting platform from your end. Like any robust web hosting admin panel, we have a host of advanced features suitable for sophisticated ecommerce scenarios. The Nexcess Client Portal is accessible for the registered clients of and well documented in the Nexcess Portal Guide.

Managed WordPress Hosting and Managed WooCommerce Hosting puts superior WordPress and WooCommerce site management capabilities at your fingertips They both provide you with tools and resources to keep your sites running at optimal levels. 

WordPress is a user-friendly application that used by the majority of web hosting providers. The core tasks of the website are primarily managed over the WordPress Admin Dashboard (aslo known as the wp-admin pageby the client's admin user. With regard to access to the wp-admin page, the credentials are used for logging in are the admin user's username and password. It is always best to use a hyper-secure strong password for the admin user's account.

24-Hour Assistance

In case you forgot the password or want to reset the password in traditional fashion, the Nexcess Support team is always available to assist you. 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.

Consider Managed WordPress with Nexcess

Try the best-in-industry hosting! Check out our Fully Managed WordPress Plans!

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. 

Explore your Trial WordPress Plan now!

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

Hosting optimized for the industry's leading platforms, including Managed WordPress Hosting, Managed WooCommerce Hosting, and Managed Magento Hosting:

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 a built-in CDN with 22 locations and advanced caching for ultra-fast loading.

All hosting plans include The Nexcess 30-Day Web Hosting Money Back Guarantee.

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 Baseincluding 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

24-Hour Assistance

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.

Useful YouTube > Nexcess Channel Links

Resources for More Information

Need more help? The Applications, WooCommerceand WordPress sections within the Nexcess Knowledge Base are important resources for those seeking additional knowledge. 

The Applications section also contains valuable insights for those seeking additional knowledge about our other various hosted applications and platforms. Check out our related video playlists and articles below:

New Customers: Fully Managed Hosting Solutions

Not a Nexcess customer yet? Check out our fully managed hosting solutions. The option to chat with an expert is also available.

Related Articles

Luke Cavanagh
Luke Cavanagh

Product Operations Manager at Nexcess. A devoted husband and tween wrangler. Synthwave enthusiast. Jerry Goldsmith fan. Doctor Who fan and related gubbins.