Yazıya resim eklerken width height değerlerini eklememek

WordPresste herhangi bir yazıya resim eklediğimizde width height değerleri ile birlikte eklenir. Eğer bunu istemiyorsak, function.php dosyasına aşağıdaki satırları eklemeliyiz;

add_filter( 'get_image_tag', 'remove_width_and_height_attribute', 10 );
add_filter( 'use_default_gallery_style', '__return_false' );
add_filter( 'post_thumbnail_html', 'remove_width_and_height_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_and_height_attribute', 10 );
function remove_width_and_height_attribute( $html ) {
   return preg_replace( '/(height|width)="\d*"\s/', "", $html );
}