First pass at making the scan for lost attachments custom post type aware. See #10911.

git-svn-id: https://develop.svn.wordpress.org/trunk@14701 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2010-05-16 21:24:40 +00:00
parent fec613607a
commit 5aa105a6af
1 changed files with 2 additions and 2 deletions

View File

@ -20,9 +20,9 @@ if ( isset($_GET['find_detached']) ) {
if ( !current_user_can('edit_posts') )
wp_die( __('You are not allowed to scan for lost attachments.') );
$all_posts = implode(',', $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type IN ('post', 'page')"));
$all_posts = implode( ',', $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type IN ('" . join("', '", get_post_types() ) . "')"));
$lost = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent > '0' and post_parent NOT IN ($all_posts)");
$_GET['detached'] = 1;
} elseif ( isset($_GET['found_post_id']) && isset($_GET['media']) ) {