WordPress functions.php tricks: Disable image compression

WordPress automatically compresses JPEG images at 90% quality. In this article, I will show you how to increase or decrease WordPress JPEG image compression. All you need to do is paste the following code in your theme’s functions.php file or your site-specific plugin. Setting it to 100 would mean that WordPress would compress the image at its highest quality. For most users, this is not an issue. Heck, we never noticed it on our site. But if you are a photographer, then this is noticeable (we suppose). There are definitely performance benefits to leaving the compression quality as is. If...

PHP functions for WordPress

Below you can find a list of source code snippets for very useful PHP functions for wordpress. You can use each one of the following parts of source code in your functions.php file: How to Increase or Decrease WordPress JPEG Image Compression WordPress does automatically compress JPEG images at 90% quality. In this article, we will show you how to increase or decrease WordPress JPEG image compression. All you need to do is paste the following code in your theme’s functions.php file or your site-specific plugin. Setting it to 100 would mean that WordPress would compress the image at its...

WordPress logo

Retrieve and get WordPress post ID outside the loop

Outside the Loop or out of the context of the post, such as in the header or the footer and even sidebar area in WordPress templates, the_ID() cannot be used as a function. Instead, $post->ID is used to return the post ID. $post is a global object that holds various information about the posts displayed on the page.