admin管理员组文章数量:1133672
When publishing a post or page that includes trusted SVG files in the content, WordPress spits out the errors Undefined array key "width" in wp-admin/includes/image.php
and Undefined array key "height" in wp-admin/includes/image.php
. The SVG files are uploaded with the upload_mimes
filter.
function file_mime_type( $mimes ) {
if( is_user_logged_in() && ! current_user_can( 'activate_plugins' ) ) {
return $mimes;
}
if( is_user_logged_in() && current_user_can( 'activate_plugins' ) ) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
}
add_filter( 'upload_mimes', 'file_mime_type' );
I'm guessing that WordPress is attempting to assign the SVG files a width and height. I didn't think that WordPress would try giving SVG files a width and height when publishing a post or page. Is there a way to exclude this from happening when publishing a post or page?
本文标签: mediaUndefined array key quotwidthquot in wpadminincludesimagephp error when publishing post or page
版权声明:本文标题:media - Undefined array key "width" in wp-adminincludesimage.php error when publishing post or page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736746660a1950813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论