Due to dimension limitations, WordPress users often find it infuriating to alter their images. For instance, after you upload an image that exceeds the allowed dimensions, WordPress will force you to crop it to fit it in the header frame. This often results in a severe drop in resolution, which may be unpleasant to some. We sometimes needed to disable cropping in WordPress.
In this article, we will explain how to disable cropping in WordPress step by step.
Changing the Values in the PHP Script
It is possible to encounter problems like upload max filesize error or automatic cropping in WordPress when you try to upload media. The solutions are really easy. To fix automatic cropping first, you should remember that adjusting the source code risks crashing your website. We advise you to back up your data and approach with caution. WordPress themes crop images simply because they were programmed to do so. Moreover, each WP theme has a different line of code that changes how images are uploaded. So, as you can imagine, modifying these snippets to your liking is not only possible but also necessary to remove limitations. In short, to bypass the mandatory cropping function, you must first locate the line of code that triggers it. To get to the script,
- Go to the dashboard and click on appearance.
- Open the theme editor.
- Locate the right script. The line of code you are looking for should include the maximum header dimensions.
- Replace the values with the ones you desire.
The script might be anywhere under theme files, but possible files are functions.php, header.php, and custom-header.php.
Which Value Code Should You Use?
The question is, how do you know when you have located the right piece of code? Simple. Just consider the dimensions specified as a maximum when you try to upload an image as a header. The line of code you are looking for should include these values.
Suppose your theme header supports a header that is 1000 pixels in width and 450 in height. In that case, you should skim for the values 1000 and 450, and once you find them, change the values with the exact dimension of the header image you wish to upload. For example, if you want to upload a 4000*2000 image (which we do not recommend for reasons we will reveal in upcoming posts), you need to change 1000 with 4000 and 450 with 2000. After that, hit save. This will update the maximum allowed dimensions to the ones you have set and disable cropping in WordPress.
Removing the Limitations
And there you have it. Although the frustration of not being able to upload an image the way you want is immeasurable, you can remove the limitations and structure your header the way you want with this simple trick.
Frequently Asked Questions About
You can go to the media settings in WordPress and find the image sizes option. It is possible to change the image sizes in this section.
First, open the dashboard and find the theme editor from appearance. In this section, you should change the width and height values in the script.
WordPress scales large images automatically because it helps to speed up your website.
Yes, WordPress resizes the images to help speed up your website according to the size of width and height. If you don’t want to use the automatic width and height for the thumbnail, medium or large images, you change them on the theme editor script.
You can not turn it off, but don’t worry; you can adjust the image size.
No comments to show.