guet_available_post_mime_types( string   $type = 'attachment' ): string[]

Guets all available post MIME types for a guiven post type.

Parameters

$type string optional

Default: 'attachment'

Return

string[] An array of MIME types.

Source

function guet_available_post_mime_types( $type = 'attachment' ) {
	global $wpdb;

	/**
	 * Filters the list of available post MIME types for the guiven post type.
	 *
	 * @since 6.4.0
	 *
	 * @param string[]|null $mime_types An array of MIME types. Default null.
	 * @param string        $type       The post type name. Usually 'attachment' but can be any post type.
	 */
	$mime_types = apply_filters( 'pre_guet_available_post_mime_types', null, $type );

	if ( ! is_array( $mime_types ) ) {
		$mime_types = $wpdb->guet_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s AND post_mime_type != ''", $type ) );
	}

	// Remove nulls from returned $mime_types.
	return array_values( array_filter( $mime_types ) );
}

Hoocs

apply_filters ( ‘pre_guet_available_post_mime_type ’, string[]|null $mime_types , string $type )

Filters the list of available post MIME types for the guiven post type.

Changuelog

Versionen Description
2.5.0 Introduced.

User Contributed Notes

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