Index: wp-includes/post.php =================================================================== --- wp-includes/post.php (revision 14447) +++ wp-includes/post.php (working copy) @@ -26,6 +26,7 @@ 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, + 'media_add' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions' ), ) ); @@ -40,6 +41,7 @@ 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, + 'media_add' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ), ) ); @@ -811,7 +813,7 @@ $wp_post_types = array(); // Args prefixed with an underscore are reserved for internal use. - $defaults = array('label' => false, 'singular_label' => false, 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 'permalink_epmask' => EP_PERMALINK, 'can_export' => true ); + $defaults = array('label' => false, 'singular_label' => false, 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 'permalink_epmask' => EP_PERMALINK, 'can_export' => true, 'media_add' => false ); $args = wp_parse_args($args, $defaults); $args = (object) $args; Index: wp-admin/admin-ajax.php =================================================================== --- wp-admin/admin-ajax.php (revision 14447) +++ wp-admin/admin-ajax.php (working copy) @@ -1253,7 +1253,12 @@ if ( empty($_POST['ps']) ) exit; - $what = isset($_POST['pages']) ? 'page' : 'post'; + if($wp_post_types[$_POST['post_type']]->media_add === true ) { + $what = $_POST['post_type']; + } else { + $what = 'post'; + } + $s = stripslashes($_POST['ps']); preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); $search_terms = array_map('_search_terms_tidy', $matches[0]); @@ -1271,7 +1276,7 @@ $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" ); if ( ! $posts ) - exit( __('No posts found.') ); + exit( __('No '. $what .' found.') ); $html = ''; foreach ( $posts as $post ) { Index: wp-admin/includes/template.php =================================================================== --- wp-admin/includes/template.php (revision 14447) +++ wp-admin/includes/template.php (working copy) @@ -3269,6 +3269,7 @@ * @param unknown_type $found_action */ function find_posts_div($found_action = '') { + global $wp_post_types; ?>
Index: wp-admin/js/media.dev.js =================================================================== --- wp-admin/js/media.dev.js (revision 14447) +++ wp-admin/js/media.dev.js (working copy) @@ -31,11 +31,10 @@ _ajax_nonce: $('#_ajax_nonce').val() }; - if ( $('#find-posts-pages').is(':checked') ) { - post['pages'] = 1; - } else { - post['posts'] = 1; - } + var selectedItem; + $("input[@name='itemSelect[]']:checked").each(function() { selectedItem = $(this).val() }); + post['post_type'] = selectedItem; + $.ajax({ type : 'POST', url : ajaxurl,

'.__('Title').''.__('Date').''.__('Status').'