WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/20/2019 08:06:22 PM (2 years ago)
Author:
adamsilverstein
Message:

Media: grid view attachment filter drop down - only show available mime types.

In the media library gird view, properly limit the media attachment filter to available mime types, matching the list view.

Props itzmekhokan.
Fixes #43658.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r44785 r44947  
    35773577    }
    35783578
     3579    // Filter to show only available mime types.
     3580    $avail_post_mime_types = get_available_post_mime_types( 'attachment' );
     3581    $mimeTypes = wp_list_pluck( get_post_mime_types(), 0 );
     3582    foreach ( $mimeTypes as $mime_type => $label ) {
     3583        if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) {
     3584            unset( $mimeTypes[ $mime_type ] );
     3585        }
     3586    }
    35793587    $settings = array(
    35803588        'tabs'             => $tabs,
    35813589        'tabUrl'           => add_query_arg( array( 'chromeless' => true ), admin_url( 'media-upload.php' ) ),
    3582         'mimeTypes'        => wp_list_pluck( get_post_mime_types(), 0 ),
     3590        'mimeTypes'        => $mimeTypes,
    35833591        /** This filter is documented in wp-admin/includes/media.php */
    35843592        'captions'         => ! apply_filters( 'disable_captions', '' ),
Note: See TracChangeset for help on using the changeset viewer.