How to Prevent Images on Posts from Being Too Large

Everyone will put images on the posts, sometimes the images displayed on the posts looks too large and may be break your current theme layout, it isn’t nice. There is a solution to avoid this problem with the help of adding the following code to your style.css file.

What you need to do is open style.css file, and simply copy and paste the following code to this file.

.post img {
max-width: 540px; /* Adjust this value according to your content area size*/
height: auto;
}

Most wordpress themes display posts content within a tag. In case this doesn’t work, you can try another way as below.

.maxwidth img {
max-width: 540px; /* Adjust this value according to your content area size*/
height: auto;
}

Use class=”maxwidth” on your IMG element. For example,

<img src="”../images/abc.jpg”" class="maxwidth" />

How to Disable WordPress AutoSave Function

Everyone should know wordpress has AutoSave function, some people really don’t like it, including me because it doesn’t help me too much. To disable AutoSave function of wordpress, simply copy and paste the following code to the function.php file. In case you want to enable again, you can just delete the code.

function disableAutoSave() {
wp_deregister_script('autosave');
}
add_action('wp_print_scripts', 'disableAutoSave');