Skip to content

Documentation

Extensive Documentation for PowerPack & WooPack to help you with common questions and issues.

PowerPack

  1. Home
  2. Docs
  3. PowerPack
  4. Modules
  5. Filterable Gallery
  6. Custom Image Size is not working?

Custom Image Size is not working?

Solution: Please add the following code to your current theme’s functions.php file:

add_filter('image_size_names_choose', function($atts) {
    // Get an array of custom image sizes
    $allImageSizes = wp_get_additional_image_sizes();
    $imageSizes = [];

    // Loop through the custom images, make a suitable array
    foreach ($allImageSizes as $key => $value) {
        $imageSizes[$key] = $key;
    }

    // Merge the new array with the existing, and return
    $atts = array_merge($atts, $imageSizes);
    return $atts;
});
Was this article helpful to you? Yes No

How can we help?

×