Customize your theme in the Theme Customizer panel. See changes live without page reloading.   

解决WordPress上传:由于安全原因,这个文件类型不受支持

当前位置:
估计的阅读时间: < 1分钟

为了更适配移动端的显示,我打算将logo使用svg格式文件.上传svg格式时提示”抱歉,由于安全原因,这个文件类型不受支持。”
可通过将以下代码放置在funciton.php文件中实现,其他格式同理.

/*自定义扩展上传文件类型支持*/
function my_custom_upload_mimes($mimes = array()) {
	// Add a key and value for the SVG file type
	$mimes['svg'] = "text/svg";
	return $mimes;
}
add_action('upload_mimes', 'my_custom_upload_mimes');
/*自定义扩展上传文件类型支持结束*/
这篇文章有帮助吗?
浏览: 0
Call to action title here