bp_attachments_get_allowed_mimes( string $type = '', array $allowed_types = array() )

Get allowed attachment mime types.


Description Description


Parameters Parameters

$type

(Optional) The extension types to get (Optional).

Default value: ''

$allowed_types

(Optional) List of allowed extensions.

Default value: array()


Top ↑

Return Return

(array) List of allowed mime types.


Top ↑

Source Source

File: bp-core/bp-core-attachments.php

function bp_attachments_get_allowed_mimes( $type = '', $allowed_types = array() ) {
	if ( empty( $allowed_types ) ) {
		$allowed_types = bp_attachments_get_allowed_types( $type );
	}

	$validate_mimes = wp_match_mime_types( join( ',', $allowed_types ), wp_get_mime_types() );
	$allowed_mimes  = array_map( 'implode', $validate_mimes );

	/**
	 * Include jpg type if jpeg is set
	 */
	if ( isset( $allowed_mimes['jpeg'] ) && ! isset( $allowed_mimes['jpg'] ) ) {
		$allowed_mimes['jpg'] = $allowed_mimes['jpeg'];
	}

	return $allowed_mimes;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.