Unzip_file causing Media file upload error
I got it to work without errors by using it inside add_attachment hook below, but now the problem is it runs on every media upload. function unzip_icon_fonts( $post_ID ){ $file_path = get_attached_file( $post_ID ); require_once(ABSPATH . ‘wp-admin/includes/file.php’); WP_Filesystem(); $destination = wp_upload_dir(); $destination_path = $destination[‘path’]; $unzipfile = unzip_file($file_path, $destination_path); } add_action( ‘add_attachment’, ‘unzip_icon_fonts’ ); I tried … Read more