Customize allowed file upload types

Note: All code examples on this site are provided for developer reference/guidance only and we cannot guarantee that they will always work as expected. Our support policy does not include assistance with modifying or debugging code from any code examples, and they may be changed or removed if we find they no longer work due to changes in our plugins.

By default, WP Job Manager only accepts the following file types in the file upload field:

  • ‘jpg|jpeg|jpe’ => ‘image/jpeg’,
  • ‘gif’ => ‘image/gif’,
  • ‘png’ => ‘image/png’,
  • ‘pdf’ => ‘application/pdf’,
  • ‘doc’ => ‘application/msword’,
  • ‘docx’ => ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’,

Company logo:

  • ‘jpg|jpeg|jpe’ => ‘image/jpeg’,
  • ‘gif’ => ‘image/gif’,
  • ‘png’ => ‘image/png’,

To customize it, use the following snippet (added support for MP4 in the example):

function filter_allowed_mime_types( $allowed_mime_types, $field ) {
	if ( 'company_logo' === $field ) {
		$allowed_mime_types = [
			'jpg|jpeg|jpe' => 'image/jpeg',
			'gif'          => 'image/gif',
			'png'          => 'image/png',
		];
	} else {
		$allowed_mime_types = [
			'jpg|jpeg|jpe' => 'image/jpeg',
			'gif'          => 'image/gif',
			'png'          => 'image/png',
			'pdf'          => 'application/pdf',
			'doc'          => 'application/msword',
			'docx'         => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
			'mp4'          => 'video/mp4',
		];
	}

	return $allowed_mime_types;
}

add_filter( 'job_manager_mime_types', 'filter_allowed_mime_types', 10, 2 );
Code Snippets Documentation