X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/d3b1ea255664edd2deef17f900a655613d20820d..8f374b7233bc2815ccc387e448d208c5434eb961:/wp-admin/includes/media.php diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index ab7cc58b..179bfb8f 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -9,7 +9,7 @@ /** * {@internal Missing Short Description}} * - * @since unknown + * @since 2.5.0 * * @return unknown */ @@ -27,7 +27,7 @@ function media_upload_tabs() { /** * {@internal Missing Short Description}} * - * @since unknown + * @since 2.5.0 * * @param unknown_type $tabs * @return unknown @@ -40,8 +40,10 @@ function update_gallery_tab($tabs) { return $tabs; } - if ( intval($_REQUEST['post_id']) ) - $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id']))); + $post_id = intval($_REQUEST['post_id']); + + if ( $post_id ) + $attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) ); if ( empty($attachments) ) { unset($tabs['gallery']); @@ -57,11 +59,12 @@ add_filter('media_upload_tabs', 'update_gallery_tab'); /** * {@internal Missing Short Description}} * - * @since unknown + * @since 2.5.0 */ function the_media_upload_tabs() { global $redir_tab; $tabs = media_upload_tabs(); + $default = 'type'; if ( !empty($tabs) ) { echo "