wppaste
WordPress

apply_filters( 'pre_get_available_post_mime_types', string[]|null $mime_types, string $type )

Since
6.4.0
Filters the list of available post MIME types for the given post type.

Compatibility

WordPress
since 6.4.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$mime_typesstring[]|null
An array of MIME types. Default null.
$typestring
The post type name. Usually 'attachment' but can be any post type.

Where this hook fires · 1

  • wp-includes/post.php:8658get_available_post_mime_types()

Source code

	 *	 * @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_get_available_post_mime_types', null, $type ); 	if ( ! is_array( $mime_types ) ) {		$mime_types = $wpdb->get_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.

Changelog

Introduced in 6.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.