How to Fix “Incompatible Archive” Error in WordPress 6.4.3 While Uploading Plugins and Themes

If you’ve run into the ‘Incompatible Archive Error’ following your update to WordPress 6.4.3, rest assured you’re in good company. This problem has left numerous WordPress users scratching their heads, particularly those who rely on MacOS for compressing their plugin zip files before uploading. Fear not, however, as we have prepared a straightforward guide to explain the roots of this issue and offer solutions on how to resolve it.

What’s Causing the “Incompatible Archive” Error?

The fundamental issue resides in the compression method used by MacOS for zip files and how WordPress 6.4.3 handles them during the upload process. Recent security improvements, which were intended to enhance the upload process, unintentionally introduced complications for zip files compressed on MacOS, resulting in the frustrating ‘Incompatible Archive’ error message. This issue has parallels with previous problems that impacted WordPress and WP-CLI, and it can be traced back to discrepancies in PHP’s libzip version.

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:

Add the filter

add_filter( 'unzip_file_use_ziparchive', '__return_false' );

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.

  1. Right-click the main plugin or theme folder.
  2. Select Send to > Compressed (zipped) folder.
  3. 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.

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.

Also Check – How to Install and Configure W3 Total Cache

What are other people reading?