这里的答案可以分为两种方法:
1) functions, that work in POST EDITOR (back-end) (参见张贴的答案)
2) functions, that work in POST OUTPUT (front-end)
p、 改变前端输出的另一种方法:
(a)
function my_image_class_filter($classes) {
return $classes . \' another-image-class\';
}
add_filter(\'get_image_tag_class\', \'my_image_class_filter\');
(b)
function add_post_image_class($content) {
return preg_replace(\'/<img(.*?)class="(.*?)"/\', \'<img $1 class="$2 YOUR_CLASS_NAME"\', $content);
}
add_filter( \'the_content\', \'add_post_image_class\' );