Posted on Leave a comment

How to change WordPress image compression

By default WordPress compresses the uploaded JPEG images and JPG images to 85%. Before WordPress 4.5 uploaded JPEG images were compressed to 90%. The compression was further increased to improve site performance for mobile users. WordPress will not compress the original uploaded image, only the generated images like large, medium, thumbnail and custom sizes.

If you want full image quality on your website (because for example you are a photographer) you want to turn off image compression in WordPress.

How to disable image compression in WordPress

You have to paste the following code in your theme’s functions.php file or in a site-specific plugin.
add_filter( 'jpeg_quality', function( $arg ) { return 100; } );
When you set the value to 100, it means that WordPress will keep the image at its highest quality.

How to increase image compression in WordPress

Compressing your images more than the default will boost your site’s speed and performance because the images will have a smaller file size. Most people will not notice the quality difference between 90% or 75%, but it will save you some extra bandwith and loading time.
add_filter( 'jpeg_quality', function( $arg ) { return 75; } );

After changing the compression ratio of your images it will only be applied to newly uploaded images. If you also want it to be applied to existing images you have to regenerate the thumbnails.

Posted on Leave a comment

How to add caption to images in WordPress

WordPress has a builtin functionality that allows you to easily add captions for images. Captions are a good way to display extra information about the image or show copyright information. After you upload an image, WordPress media uploader allows you to provide image title, description, and caption. You can also add captions to existing images by editing the image.

WordPress caption example
This is a caption example

Caption through shortcode

There is also a way to do it with a shortcode:
<image> Caption
For a full documentation of the caption shortcode read

Posted on Leave a comment

Difference between WordPress categories, taxonomies and tags

Categories, tags, taxonomies and terms are all related in WordPress. But whats the difference?

WordPress taxonomies

The default taxonomies in WordPress are:

  • Categories: a hierarchical taxonomy that organizes content in the post Post Type.
  • Tags: a non-hierarchical taxonomy that organizes content in the post Post Type.
  • Post formats: a method for creating formats for your posts.
  • Custom taxonomies: created by a plugin or theme.

Every category and tag is actually a taxonomy. The big difference is that categories are hierarchical and tags are non-hierarchical.

In short: a taxonomy is a way to group things together.


Terms are items within a taxonomy. For example, if you have the taxonomy (category) Animal you would have the terms cat, dog and bird.

Categories in the WordPress media library

By default WordPress has no support for categories in the media library. Luckily there is a plugin that creates categories in the WordPress Media library.