Incompatible Archive Error in WordPress 6.4.3 While Uploading Plugins and Themes – Divi Extended

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.

This content was originally published here.