Don't show trashed attachments in gallery tab count, props aldenta, fixes #11147
git-svn-id: https://develop.svn.wordpress.org/trunk@12190 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3e1d80eb42
commit
e085e3485e
|
@ -40,8 +40,10 @@ function update_gallery_tab($tabs) {
|
||||||
return $tabs;
|
return $tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( intval($_REQUEST['post_id']) )
|
$post_id = 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'])));
|
|
||||||
|
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) ) {
|
if ( empty($attachments) ) {
|
||||||
unset($tabs['gallery']);
|
unset($tabs['gallery']);
|
||||||
|
|
Loading…
Reference in New Issue