If you’ve encountered the ‘Incompatible Archive Error’ after updating to WordPress 6.4.3, you’re not alone. This issue has puzzled many in the WordPress community, especially those using MacOS to compress their plugin zip archives for upload. But don’t worry, we’ve got you covered with an easy-to-understand guide on why this is happening and how you can fix it.
What’s Causing the Error?
The core of the problem lies in the way MacOS compresses zip files and how WordPress 6.4.3 interprets them upon upload. Recent security enhancements aimed at tightening up the upload process inadvertently introduced challenges for MacOS compressed zip files, leading to the dreaded ‘Incompatible Archive’ error message. Similar issues previously affected WordPress and WP-CLI and the behavior ties back to PHP’s libzip version discrepancies.
A Look at the Error
How to Fix the Issue
Thankfully, the WordPress community is vibrant and quick to respond. Through collective effort, several workarounds have been identified. Here are the steps you can take to navigate this issue:
Recompress Using Windows File Explorer
Suppose you are a customer who made a purchase or downloaded a product file and facing the issue and are also a Windows user. In that case, you can extract the zip file you have downloaded, and compress the main directory/folder again. Here are the steps.
- Right-click the main plugin or theme folder.
- Select Send to > Compressed (zipped) folder.
- Use it to upload.
After re-zipping your file on Windows, you can test the upload process in your WordPress site to ensure the “Incompatible Archive” error does not occur. If the problem persists, it might be unrelated to the zip file’s creation method and could be due to other factors such as file permissions, server configurations, or a specific issue with the WordPress installation.
Use the MacOS Command Line for Compression
Instead of using the MacOS right-click ‘Compress’ option, compress your plugin folder using the terminal. Here’s how:
zip -r my-plugin.zip my-plugin/
This method ensures compatibility with WordPress’s upload process.
Apply a Temporary Plugin Solution
A plugin has been developed by Aaron Jorbin to force WordPress to use PclZip instead of ZipArchive, effectively bypassing the issue. You can install and activate this plugin as a temporary fix.
// Reference code for developers.
add_filter('unzip_file_use_ziparchive', '__return_false');
Click here to download the PclZip plugin.
Implement a fallback to PclZip if ZipArchive::open() Fails
Here is a code snippet for developers to implement a fallback solution.
// Potential workaround in custom code until official fix is deployed
if (!$zip->open($file_path) === TRUE) {
use PclZip instead of ZipArchive
}
Looking Ahead
The WordPress community is actively working on a patch to resolve this issue in an upcoming release. By staying engaged with the community through forums and tracking updates, you can stay informed about the latest solutions and ensure your site remains unaffected.
WordPress’s strength lies in its community. Issues like the ‘Incompatible Archive Error’ remind us of the importance of collaboration and shared knowledge in overcoming challenges. With the steps outlined above, you’ll be able to navigate this hiccup and continue leveraging WordPress to its fullest potential.
@JELO thank you for the explanation on suggestion to open Terminal directly from the file within which the archived file is being held. I would never have figured this out, being a novice. 5 Stars to you, sir!
My issue was the my browser, Safari was decompressing the zip files on download. I went to settings>general and unchecked the “safe” download checkbox. This keeper the zip file and it uploaded to WordPress no problem!
Or you could consider simply providing a zip file instead of regular folder or for the rest of the hard that does not work with WinPCs. Another option is to use online zip service if you don’t have access to a Windows PC and simply do that. I used EzyZip – took less than a minute to upload, zip, download and install.
Recompressing Helped. Thankyou
A few more instructions should be added for those not super familiar with Terminal such as myself. It took me awhile to figure it out as I kept getting error messages. The way that eventually worked for me was “right-clicking” on the pathname ‘Downloads’ (where my folder was located) at the bottom of the Finder window and opening Terminal from there rather than opening it from Launchpad. I’ve used Terminal before without having to open it from a specific location so I was unaware that was even a thing. But once I was able to figure that out installing my new theme worked perfectly. Thank you.
Wow – the plugin worked like magic! What a simple solution! I just uploaded the original zip file of my theme. Thank you SO much for this plugin it just simplifies my life and bypassing the steps of decompressing and compressing folders.
Unzip the flexile folder, re-compress with forklift on the mac and you should be ok. Forklift is free in the App store.
Oh my god! to day my wordpress update to 6.4.3 and cannot upload Theme zip in my Macos, i tried zip -r my-theme.zip my-theme/ and work well! thank you
Thx, recompress help me!
THANK YOU!