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?

0

Found my solution after a little more digging.

The problem lies in wordpress-importer

Found this from jan 30 on github:

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

Then later the solution here:

https://www.playnicetogether.com/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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.