Make WordPress Core

Changeset 12190


Ignore:
Timestamp:
11/16/2009 07:54:02 AM (15 years ago)
Author:
azaozz
Message:

Don't show trashed attachments in gallery tab count, props aldenta, fixes #11147

File:
1 edited

Legend:

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

    r12189 r12190  
    4141    }
    4242
    43     if ( intval($_REQUEST['post_id']) )
    44         $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])));
     43    $post_id = intval($_REQUEST['post_id']);
     44
     45    if ( $post_id )
     46        $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 ) ) );
    4547
    4648    if ( empty($attachments) ) {
Note: See TracChangeset for help on using the changeset viewer.