Not possible to upload plugin or theme with WordPress 6.4.3

If. you update WordPress to version 6.4.3 you may have a problem with the uploading of plugins and themes.

The bug of WordPress 6.4.3 is triggered when you try to upload a plugin or a theme that was zipped using a Mac and the ZipArchive module is active on your server.

In this case, you will see the error “Incompatible Archive“.

WordPress 6.4.3 Incompatible Archive error when trying to upload a zip

To solve this issue you can add this line of code in the functions.php of your child theme or a functional plugin:

add_filter( 'unzip_file_use_ziparchive', '__return_false' );
 

The line of code above will ask WordPress to use the PclZip class instead of the ZipArchive module.

If you don’t feel confident in writing PHP code you can also download the plugin Upload Bug Fix For WP 6.4.3.

If you are a plugin or theme developer and you create the zip files with your Mac, then you can fix this issue by following these steps:

  • Open the Terminal window on your Mac
  • Write the command to go to the directory where you have the zip file
  • Write the following command:

    zip -d your-plugin-name.zip “__MACOSX*”

This will automatically remove all the hidden files called _macosx from the zip. Without those files your zip will be uploaded without problems.
Of course, change “your-plugin-name” with the name off your plugin or theme.