get_available_post_mime_types

The timeline below displays how wordpress function get_available_post_mime_types has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Gets all available post MIME types for a given post type.
 *
 * @since 2.5.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $type
 * @return string[] An array of MIME types.
 */
function get_available_post_mime_types($type = 'attachment')
{
    global $wpdb;
    /**
     * Filters the list of available post MIME types for the given 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_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", $type));
    }
    return $mime_types;
}

WordPress Version: 6.1

/**
 * Gets all available post MIME types for a given post type.
 *
 * @since 2.5.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $type
 * @return string[] An array of MIME types.
 */
function get_available_post_mime_types($type = 'attachment')
{
    global $wpdb;
    $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM {$wpdb->posts} WHERE post_type = %s", $type));
    return $types;
}

WordPress Version: 4.4

/**
 * Get all available post MIME types for a given post type.
 *
 * @since 2.5.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $type
 * @return mixed
 */
function get_available_post_mime_types($type = 'attachment')
{
    global $wpdb;
    $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM {$wpdb->posts} WHERE post_type = %s", $type));
    return $types;
}

WordPress Version: 4.3

/**
 * Get all available post MIME types for a given post type.
 *
 * @since 2.5.0
 *
 * @global wpdb $wpdb
 *
 * @param string $type
 * @return mixed
 */
function get_available_post_mime_types($type = 'attachment')
{
    global $wpdb;
    $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM {$wpdb->posts} WHERE post_type = %s", $type));
    return $types;
}

WordPress Version: 4.2

/**
 * Get all available post MIME types for a given post type.
 *
 * @since 2.5.0
 *
 * @param string $type
 * @return mixed
 */
function get_available_post_mime_types($type = 'attachment')
{
    global $wpdb;
    $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM {$wpdb->posts} WHERE post_type = %s", $type));
    return $types;
}

WordPress Version: 4.1

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param string $type
 * @return mixed
 */
function get_available_post_mime_types($type = 'attachment')
{
    global $wpdb;
    $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM {$wpdb->posts} WHERE post_type = %s", $type));
    return $types;
}

WordPress Version: 3.7

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param unknown_type $type
 * @return unknown
 */
function get_available_post_mime_types($type = 'attachment')
{
    global $wpdb;
    $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM {$wpdb->posts} WHERE post_type = %s", $type));
    return $types;
}