How To Disable Feature Image Auto-Cropping in WordPress

By | October 26, 2020

Not all feature images are supposed to be cropped. Especially when you’re writing a comic strip with wide aspect ratio. Getting the images on front page cropped look pretty untidy.

Thankfully there is a workaround to fix this. Unfortunately, this requires access to the php file in the server. If you do not have write access to the files, too bad. In my opinion, theme developers should really allow this to be configurable.

If you do, do the following:

  1. Download your file via ftp or sftp.
  2. Your file is located somewhere in /<wordpress dir>/wp-content/themes/<your theme>/function.php
  3. Edit the file and change all the add_image_size() function’s fourth parameter to false. The fourth parameter determines whether to crop the image or not. See image below.
Modify all add_image_size()’s fourth parameter to false.

4. Upload the file function.php back to the server overwriting the file. Make sure you have a backup and make sure the new file has correct permission (i.e. same as previous pre-edited one).

Using ssh to access and edit on the server is recommended providing that your server allows that and you know how to use ssh command as well as using editing tool there. A topic for another article perhaps.

5. You need to regenerate thumbnails. I’d recommend using plugin ‘Regenerate Thumbnails’. You can also regenerate specific thumbnails from Media Library using this plugin.

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *