Last active
April 22, 2024 06:20
-
-
Save Rupashdas/b81f21a1abfd1cb4120971c41112bd33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function devrupash_remove_max_srcset_image_width( $max_width ) { | |
return false; | |
} | |
add_filter( 'max_srcset_image_width', 'devrupash_remove_max_srcset_image_width' ); | |
function devrupash_disable_srcset( $sources ) { | |
return false; | |
} | |
add_filter( 'wp_calculate_image_srcset', 'devrupash_disable_srcset' ); | |
function devrupash_remove_width_attribute( $html ) { | |
$html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); | |
return $html; | |
} | |
add_filter( 'wp_get_attachment_image', 'devrupash_remove_width_attribute', 10 ); | |
add_filter( 'post_thumbnail_html', 'devrupash_remove_width_attribute', 10 ); | |
add_filter( 'image_send_to_editor', 'devrupash_remove_width_attribute', 10 ); | |
function devrupash_disable_image_compression() { | |
return 100; | |
} | |
add_filter( 'wp_editor_set_quality', 'devrupash_disable_image_compression'); | |
add_filter( 'jpeg_quality', 'devrupash_disable_image_compression' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment