diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 9684b1b773..e91d08b423 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -875,23 +875,6 @@ function wp_edit_posts_query( $q = false ) {
return $avail_post_stati;
}
-/**
- * Get default post mime types
- *
- * @since 2.9.0
- *
- * @return array
- */
-function get_post_mime_types() {
- $post_mime_types = array( // array( adj, noun )
- 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image (%s)', 'Images (%s)')),
- 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio (%s)', 'Audio (%s)')),
- 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video (%s)', 'Video (%s)')),
- );
-
- return apply_filters('post_mime_types', $post_mime_types);
-}
-
/**
* {@internal Missing Short Description}}
*
diff --git a/wp-includes/js/media-models.js b/wp-includes/js/media-models.js
index 542cfc0aa8..b673e87845 100644
--- a/wp-includes/js/media-models.js
+++ b/wp-includes/js/media-models.js
@@ -671,6 +671,9 @@ window.wp = window.wp || {};
// Generate the query `args` object.
// Correct any differing property names.
_.each( props, function( value, prop ) {
+ if ( _.isNull( value ) )
+ return;
+
args[ Query.propmap[ prop ] || prop ] = value;
});
diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js
index b26ad6f890..eb846f821b 100644
--- a/wp-includes/js/media-views.js
+++ b/wp-includes/js/media-views.js
@@ -2766,54 +2766,74 @@
change: 'change'
},
+ filters: (function() {
+ var filters = {};
+
+ _.each( media.view.settings.mimeTypes || {}, function( text, key ) {
+ filters[ key ] = {
+ text: text,
+ props: {
+ type: key,
+ parent: null
+ }
+ };
+ });
+
+ filters.all = {
+ text: l10n.allMediaItems,
+ props: {
+ type: null,
+ parent: null
+ },
+ priority: 10
+ };
+
+ filters.uploaded = {
+ text: l10n.uploadedToThisPost,
+ props: {
+ type: null,
+ parent: media.view.settings.postId
+ },
+ priority: 20
+ };
+
+ return filters;
+ }()),
+
initialize: function() {
- var els;
-
- els = _.map({
- all: 'allMediaItems',
- uploaded: 'uploadedToThisPost',
- image: 'images',
- audio: 'audio',
- video: 'videos'
- }, function( text, value ) {
- return this.make( 'option', { value: value }, l10n[ text ] );
- }, this );
-
- this.$el.html( els );
+ // Build `