Written by Anonymous
<?php //子テーマ用関数
if ( !defined( 'ABSPATH' ) ) exit;
//子テーマ用のビジュアルエディタースタイルを適用
add_editor_style();
//以下に子テーマ用の関数を書く
remove_filter('the_content', 'wpautop');
//▼画像貼り付け時の自動挿入タグを削除▼
add_filter( 'image_send_to_editor', 'remove_image_attribute', 10 );
add_filter( 'post_thumbnail_html', 'remove_image_attribute', 10 );
function remove_image_attribute( $html ){
$html = preg_replace( '/(width|height)="\d*"\s/', '', $html );
$html = preg_replace( '/class=[\'"]([^\'"]+)[\'"]/i', '', $html );
return $html;
}
//▲画像貼り付け時の自動挿入タグを削除▲
function oz_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) {
$html = preg_replace('/(s)?class=".+?"(s/)?/', '', $html);
return $html;
}
add_filter('image_send_to_editor', 'oz_image_send_to_editor', 1000, 8);