New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get custom image sizes added with add_image_size() #6499
Comments
Hi @mrleemon, The custom image sizes will only appear if they've been generated for the image. Regenerate Thumbnails is a plugin that lets you regenerate image sizes from the admin, and |
I remember using the Regenerate Thumbnails plugin to generate the custom size thumbnails and after that still seeing just the core size images. I'll try again, maybe that part of the GB code has changed recently. |
The |
I can confirm this behavior:
I'm not sure I follow what you mean by this. Can you clarify? |
The |
@mrleemon Ok. Can you take a step back and tell me what you're trying to do, and why you're directly modifying the gallery block? |
Perhaps related to #1450? |
Right now, with the old But not with the new gallery block because one cannot select the source image size. |
Makes sense, thanks for clarifying.
Directly modifying the gallery block code is strongly discouraged. Being able to select the image size is tracked with #1450 |
@Shanery I got the custom image sizes to appear in the admin by adding: add_action( 'admin_init', function() {
$custom_sizes['my-custom-sizes'] = 'My Custom Size';
add_filter(
'image_size_names_choose',
function( $sizes ) use ( $custom_sizes ) {
return array_merge( $sizes, $custom_sizes );
}
);
}); Remember that they will only show up for images that have been upload after the new image sizes have been defined (IIRC - HTH). @danielbachhuber Any idea why the custom image sizes aren't showing up in wp-cli? I'm only seeing the default sizes, e.g.: thumbnail, medium, medium_large, large, and full. |
Issue Overview
Fiddling with the gallery block code I managed to get the thumbnail size of images in addition to their full size using the following code:
But checking the input
images
parameter I see that there are no references to custom sizes added with theadd_image_size()
function, just the core ones. Is this the expected behavior?The text was updated successfully, but these errors were encountered: