我已经解决了这个问题,去掉了WP设置的所有宽度和高度属性:
//tidy up img tags. We don\'t want inline height and width added by WP.
//we\'d rather use media queries and fluid img.
function remove_image_dim_attr($html) {
$html=preg_replace( \'/width=(["\\\'])(.*?)\\1/\', \'\', $html );
$html=preg_replace( \'/height=(["\\\'])(.*?)\\1/\', \'\', $html );
return $html;
}
add_filter( \'get_image_tag\',\'remove_image_dim_attr\' );
add_filter( \'image_send_to_editor\',\'remove_image_dim_attr\' );
add_filter( \'post_thumbnail_html\',\'remove_image_dim_attr\' );