How to set the default image size in WordPress galleries

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

remove_shortcode('gallery');
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!

Leave a Reply

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