Disable srcset and own-size medium
-
Hi, I′ve got problem with generating thumbnail on new version WP.
I make my thumbnail with resolution 500x500px.1)
If I call:
echo get_the_post_thumbnail($post->id, ‘my-thumbnail-size-500-500’);
I get:
<img width=”5760″ height=”3840″ src=”domain.CCCC/…_XXL.jpg” class=”attachment-my-thumbnail-size-500-500 size-my-thumbnail-size-500-500 wp-post-image img-responsive” srcset=”domain.CCCC/…_XXL.jpg 5760w, domain.CCCC/…_XXL-300×200.jpg 300w, domain.CCCC/…_XXL-768×512.jpg 768w, domain.CCCC/…_XXL-1200×800.jpg 1200w” sizes=”(max-width: 5760px) 100vw, 5760px”>2)
If I disable srcset:
function disable_srcset( $sources ) {
return false;
}
add_filter( ‘wp_calculate_image_srcset’, ‘disable_srcset’ );
and call get_the_post_thumbnail like up, I get:
<img width=”5760″ height=”3840″ src=”domain.CCCC/…_57573024_XXL.jpg” class=”attachment-my-thumbnail-size-500-500 size-my-thumbnail-size-500-500 wp-post-image img-responsive” >BUT i need:
<img width=”500″ height=”500″ src=”domain.CCCC/…_57573024_XXL_500-500.jpg ” class=”attachment-my-thumbnail-size-500-500 size-my-thumbnail-size-500-500 wp-post-image img-responsive” >Anyone knows?
- The topic ‘Disable srcset and own-size medium’ is closed to new replies.