最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

xml - import svg-files from wxr - (upload works, import not)

programmeradmin0浏览0评论

Upload works - Import from wxr not

We're updating several sites with a new page, imported from a wxr file. Page, included form, jpg, png - all work fine but SVG not so much.

I've checked scripts that add svg to allowed mime, ($mimes['svg'] = 'image/svg+xml';$mimes['svg'] = 'image/svg'; etc)

I've testet plugins (safeSvg, Disable Real MIME Check)

I've even added define( 'ALLOW_UNFILTERED_UPLOADS', true ); into wp-config!

Same result - every time: "unable to import."

But regular upload works.

Any Ideas how to solve this?

Upload works - Import from wxr not

We're updating several sites with a new page, imported from a wxr file. Page, included form, jpg, png - all work fine but SVG not so much.

I've checked scripts that add svg to allowed mime, ($mimes['svg'] = 'image/svg+xml';$mimes['svg'] = 'image/svg'; etc)

I've testet plugins (safeSvg, Disable Real MIME Check)

I've even added define( 'ALLOW_UNFILTERED_UPLOADS', true ); into wp-config!

Same result - every time: "unable to import."

But regular upload works.

Any Ideas how to solve this?

Share Improve this question edited Sep 12, 2019 at 8:39 Matthew Brown aka Lord Matt 1,0683 gold badges13 silver badges34 bronze badges asked Sep 12, 2019 at 7:59 Leif S.Leif S. 232 bronze badges 1
  • Hi Leif S., welcome to WordPress Development. Your question may need editing to get the best answers. As a quick guide, pretend you are talking to a busy colleague and have to tell them everything they absolutely need to give you a clear answer before they rush away. Check our guide to asking good questions if you need to. – Matthew Brown aka Lord Matt Commented Sep 12, 2019 at 8:13
Add a comment  | 

1 Answer 1

Reset to default 0

Found my solution after a little more digging.

The problem lies in wordpress-importer

Found this from jan 30 on github:

https://github/WordPress/wordpress-importer/issues/47?_pjax=%23js-repo-pjax-container

Then later the solution here:

https://www.playnicetogether/2015/11/07/wordpress-importer-plugin-content-length-problem-solved/

"the WordPress Importer plugin is not compatible with remote servers that use HTTP compression."

For WordPress v4.6 and above, please use the following:

add_filter( 'http_request_args', function( $r, $url ) { $r['headers']['Accept-Encoding'] = 'identity'; return $r; }, 10, 2 );

This solved the upload issue, and the plugin "SafeSvg" made the svg's show up in the media library.

发布评论

评论列表(0)

  1. 暂无评论