- This topic has 18 replies, 2 voices, and was last updated 4 years, 4 months ago by
Tom.
-
AuthorPosts
-
January 12, 2019 at 3:21 pm #780276
Sibi Paul
Sir…
My Site is WP Fresh Installation.
Installed GP & Removed All Default Themes.
Added Few Post and Added few Featured Images.
Image Size Uploaded 1200×800
When I Looks into Cpanel – File Manager – WP uploads Folder
There are 4 Different Size of Images Showing
One Image uploaded and WordPress generating 4 different sizes.
So, I came to WP Dashboard and Set the Image Sizes to zero.
Thumbnail
medium
Large
all set to zero.
———-
Then I removed All the Uploaded And generated Images…
Then , Uploaded Image Again…
There now Shows two Images,
1 – is the Original, which actually i wanted..
Another one is size 768×512.
I think this Image Size is Not Generated by WordPress.
768×512 image is not showing in my other sites They uses WP Default themes.
in those Sites Only showing One Image – which we uploaded.
So, Here…
768×512 image is a NON used Image, which created by GP….
So, Where and How, I can Stop Generating this Image size.
January 12, 2019 at 8:45 pm #780394Tom
Lead DeveloperLead DeveloperHi there,
GP doesn’t create any additional image sizes unless you have sizes set in Customize > Layout > Blog.
I believe what you’re seeing are the sizes created by WordPress to be used by
srcset
.Disabling
srcset
should stop those images from generating:add_filter( 'wp_calculate_image_srcset', '__return_false' );
January 12, 2019 at 11:15 pm #780417Sibi Paul
Where to Add This Code ?
add_filter( ‘wp_calculate_image_srcset’, ‘__return_false’ );
January 12, 2019 at 11:22 pm #780419Sibi Paul
I added That Code in functions.php
added bottom
Still site creates that size images in file manager.
if code needs to add some where else, plz let me know where….
January 12, 2019 at 11:44 pm #780425Sibi Paul
Then I added This Code in Functions.php
function disable_srcset( $sources ) {
return false;
}
add_filter( ‘wp_calculate_image_srcset’, ‘disable_srcset’ );that also not works, image still creating.
January 12, 2019 at 11:46 pm #780426Sibi Paul
Then i tried This
/**
* Disable responsive image support
*/
// Clean the up the image from wp_get_attachment_image()
add_filter( ‘wp_get_attachment_image_attributes’, function( $attr )
{
if( isset( $attr[‘sizes’] ) )
unset( $attr[‘sizes’] );if( isset( $attr[‘srcset’] ) )
unset( $attr[‘srcset’] );return $attr;
}, PHP_INT_MAX );
// Override the calculated image sizes
add_filter( ‘wp_calculate_image_sizes’, ‘__return_false’, PHP_INT_MAX );// Override the calculated image sources
add_filter( ‘wp_calculate_image_srcset’, ‘__return_false’, PHP_INT_MAX );// Remove the reponsive stuff from the content
remove_filter( ‘the_content’, ‘wp_make_content_images_responsive’ );That also not worked
i added in wp-dashboard>appearance>editor>function.php
January 12, 2019 at 11:46 pm #780428Sibi Paul
/** * Disable responsive image support */ // Clean the up the image from wp_get_attachment_image() add_filter( 'wp_get_attachment_image_attributes', function( $attr ) { if( isset( $attr['sizes'] ) ) unset( $attr['sizes'] ); if( isset( $attr['srcset'] ) ) unset( $attr['srcset'] ); return $attr; }, PHP_INT_MAX ); // Override the calculated image sizes add_filter( 'wp_calculate_image_sizes', '__return_false', PHP_INT_MAX ); // Override the calculated image sources add_filter( 'wp_calculate_image_srcset', '__return_false', PHP_INT_MAX ); // Remove the reponsive stuff from the content remove_filter( 'the_content', 'wp_make_content_images_responsive' );
January 13, 2019 at 8:48 am #780754Tom
Lead DeveloperLead DeveloperJanuary 13, 2019 at 8:55 am #780761Sibi Paul
Edit File in The Function.php or inc folder functions.php ?
January 13, 2019 at 9:06 am #780768Tom
Lead DeveloperLead DeveloperPHP should be added using one of these methods: https://docs.generatepress.com/article/adding-php/
January 13, 2019 at 10:50 am #780832Sibi Paul
Oh no…
Then your First Solution Might Work…
i did not tried yet…
I am adding all the codes in function.php bottom line…
so you Saying, thats wrong ?
Then why you not said it first… ?
January 13, 2019 at 5:16 pm #781003Tom
Lead DeveloperLead DeveloperIf it’s a child theme, the child
functions.php
file will work fine.The actual parent theme shouldn’t ever be modified, as your changes will go away when you update the theme.
January 13, 2019 at 10:47 pm #781110Sibi Paul
Very Sad, and the bad side of this forum is…
Nobody saying things clearly.
Simply make it Clear…
I don’t want to wait 24 hours for each reply and that not solves my problem.
Just Give me 3 steps
1 – Which Code I have to Add
2 – Where to Add
3 – How to Add
NOTE: if you answered this in the very first day, It could be better and I will be loved your support.
Whatever Your Support is, I would Like to Use generate Press for my All Sites.
And Plans Writing a Great post in my WP niche Blog.
Meanwhile, let me know about the GP affiliate.
January 13, 2019 at 11:09 pm #781112Tom
Lead DeveloperLead DeveloperI haven’t given you an exact solution because I’m not sure what the exact solution is. However, I’m pretty sure the solution lies in the topic I linked to above: https://wordpress.stackexchange.com/a/251810
So you would copy this code:
add_filter( 'intermediate_image_sizes', '__return_empty_array', 999 );
And add it using one of these methods: https://docs.generatepress.com/article/adding-php/
I’m sorry if our response time hasn’t been as quick as you’d like, but we try to answer everyone within 12 hours, 7 days a week.
Hopefully the above works for you. If not, we’ll keep looking until we find a solution 🙂
January 13, 2019 at 11:41 pm #781121Sibi Paul
this worked….
can we simplify the code ?
-
AuthorPosts
- You must be logged in to reply to this topic.