DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

By default, built-in WordPress galleries use the size “full” for the image but in some cases it’s better set a different size. Here is an easy to use code snippet to set the default image size in your galleries.

Simply paste the following snippet into your functions.php file:

add_shortcode('gallery', 'custom_size_gallery');
function custom_size_gallery($attr) {
     $attr['size'] = 'medium';
     return gallery_shortcode($attr);

The desired size can be changed on line 5.

Thanks to emoticode for the cool tip!


One Comment

  1. You can filter the parameters passed to the gallery shortcode, without the need to change the shortcode handler: https://gist.github.com/shazdeh/8188033

Leave a Comment

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