Skip to content

Posted in: General Snippets | View All

Important: Snippet Placement

Allow upload of AI files (Adobe Illustrator)

This snippet registers the AI file MIME type so that the site will allow .ai files to be uploaded to the WordPress Media Library. This should also allow Gravity Forms file upload fields to accept AI file types.

This snippet should be added when the customer wants to be able to upload AI files on their site.

      // Registering the AI MIME type. This allows .ai files to be uploaded to the media library
function wds_upload_mimes( $existing_mimes ) {
	// Add ai to the list of mime types.
	$existing_mimes['ai'] = 'application/postscript';
	$existing_mimes['ai'] = 'application/illustrator';
	$existing_mimes['ai'] = 'adobe.illustrator';
	$existing_mimes['ai'] = 'application/pdf';
	// Return the array back to the function with our added mime type.
	return $existing_mimes;
}
add_filter( 'mime_types', 'wds_upload_mimes' );
  

Audit History

Passed | May 4, 2023 | By jcullen

Scroll To Top