1.如何解决wordpress加载Gravatar图像慢问题
你可以将以下代码加入到你当前使用的主题中的functions.php文件中:
//Gravatar头像修复
function Fanly_get_
2.WordPress 文章中插入图片怎样自动去除img的width、height、class属性
直接上代码:
//remove insert images attribute
//add_filter( 'the_content', 'fanly_remove_images_attribute', 99 );
add_filter( 'post_thumbnail_html', 'fanly_remove_images_attribute', 10 );
add_filter( 'image_send_to_editor', 'fanly_remove_images_attribute', 10 );
function fanly_remove_images_attribute( $html ) {
//$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
$html = preg_replace( '/width="(\d*)"\s+height="(\d*)"\s+class=\"[^\"]*\"/', "", $html );
$html = preg_replace( '/ /', "", $html );
return $html;
}在当前主题的functions.php中添加以上代码即可。
代码参考资料: (版权归原作者所有)
转载请注明出处51数据库 » wordpress图片https