ameeeee
10/1/2019 - 8:24 AM

WP ビジュアルエディタで画像挿入時の横幅縦幅指定を削除

function remove_width_attribute( $html ) {
$html = preg_replace( ‘/(width|height)=”\d*”\s/’, “”, $html );
return $html;
}
add_filter( ‘post_thumbnail_html’, ‘remove_width_attribute’, 10 );
add_filter( ‘image_send_to_editor’, ‘remove_width_attribute’, 10 );