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, + 'attachment' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions' ), ) ); @@ -40,6 +41,7 @@ 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, + 'attachment' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ), ) ); @@ -795,6 +797,7 @@ * supports - An alias for calling add_post_type_support() directly. See add_post_type_support() for Documentation. Defaults to none. * register_meta_box_cb - Provide a callback function that will be called when setting up the meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback. * taxonomies - An array of taxonomy identifiers that will be registered for the post type. Default is no taxonomies. Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type(). + * attachment - Whether to add attachments to this post type. Defaults to false. * * @package WordPress * @subpackage Post @@ -811,7 +814,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, 'attachment' => 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(!empty($_POST['post_type']) && in_array($_POST['post_type'], get_post_types(array('attachment' => 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 = '
'.__('Title').' | '.__('Date').' | '.__('Status').' |
---|