diff --git a/includes/class-delete-api.php b/includes/class-delete-api.php index d471f6b..843a632 100644 --- a/includes/class-delete-api.php +++ b/includes/class-delete-api.php @@ -171,20 +171,29 @@ public function do_delete_posts( $post_ids = array(), $force_delete = false, $it } if( ! empty( $post_ids ) && count( $post_ids ) > 0 ) { - - $post_attechment_id = get_post_meta( $post_id, '_thumbnail_id', true ); - $attechment_ids = $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $post_attechment_id" ); - if( isset( $item['post_media'] ) && $item['post_media'] === 'yes' ){ - if( count( $attechment_ids ) <= 1 ){ - wp_delete_attachment( $post_attechment_id, $force_delete ); - } - } - + if( $custom_query == 'custom_query' ){ + + foreach( $post_ids as $post_id ){ + $post_attechment_id = get_post_meta( $post_id, '_thumbnail_id', true ); + $attechment_ids = $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $post_attechment_id" ); + if( isset( $item['post_media'] ) && $item['post_media'] === 'yes' ){ + if( count( $attechment_ids ) <= 1 ){ + wp_delete_attachment( $post_attechment_id, $force_delete ); + } + } + } $all_posts = implode( ",",$post_ids ); $wpdb->query( "DELETE p,pt,pm FROM " . $wpdb->posts . " p LEFT JOIN " . $wpdb->term_relationships . " pt ON pt.object_id = p.ID LEFT JOIN " . $wpdb->postmeta . " pm ON pm.post_id = p.ID WHERE p.ID IN ({$all_posts})" ); }else{ - foreach ($post_ids as $post_id ) { + foreach ($post_ids as $post_id ){ + $post_attechment_id = get_post_meta( $post_id, '_thumbnail_id', true ); + $attechment_ids = $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $post_attechment_id" ); + if( isset( $item['post_media'] ) && $item['post_media'] === 'yes' ){ + if( count( $attechment_ids ) <= 1 ){ + wp_delete_attachment( $post_attechment_id, $force_delete ); + } + } if( $force_delete === false ){ wp_trash_post( $post_id ); }else{ diff --git a/includes/delele-posts-form-functions.php b/includes/delele-posts-form-functions.php index 3479e21..600948e 100644 --- a/includes/delele-posts-form-functions.php +++ b/includes/delele-posts-form-functions.php @@ -112,44 +112,92 @@ function xt_delete_posts_form_process( $data ) { * @return void */ function wpbd_render_form_posttype(){ - global $wp_post_types; - $ingnore_types = array( 'attachment','revision','nav_menu_item','custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'wp_block', 'wp_template', 'wp_template_part', 'wp_global_styles', 'wp_navigation' ); - $types = array(); - if( !empty( $wp_post_types ) ){ - foreach( $wp_post_types as $key_type => $post_type ){ - if( in_array( $key_type, $ingnore_types ) ){ - continue; - }else{ - $types[$key_type] = $post_type->labels->name; + global $wp_post_types; + $ingnore_types = array( 'attachment','revision','nav_menu_item','custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'wp_block', 'wp_template', 'wp_template_part', 'wp_global_styles', 'wp_navigation' ); + $types = array(); + if( !empty( $wp_post_types ) ){ + foreach( $wp_post_types as $key_type => $post_type ){ + if( in_array( $key_type, $ingnore_types ) ){ + continue; + }else{ + $types[$key_type] = $post_type->labels->name; + } + } + } + ?> + + + + + + $type ){ + $disable = ''; + if( ( $type === "Orders" || $type == "Coupons" || $type == "Refunds" ) && !wpbd_is_pro() ){ + $disable = "disabled"; + } + ?> +
+ +
+ + + + $post_type ){ + if( in_array( $key_type, $ingnore_types ) ){ + continue; + }else{ + $types[$key_type] = $post_type->labels->name; } } - ?> - - - - - + } + ?> + + + + + + > - - = 0 ){ - echo '('.$post_count .' '. $type .')'; - } - if( $disable == "disabled" ){ - do_action( 'wpbd_display_available_in_pro'); - } - ?> + - - - $post_type ){ - if( in_array( $key_type, $ingnore_types ) ){ - continue; - }else{ - $types[$key_type] = $post_type->labels->name; - } - } - } - ?> - - - - - - - - - + + + - - - - - - - - -
- - - - - - - - - + ?> + + + + + + - -
- - - - + + + +
+ + + + + + + + + + + +
+ + + + - - - - - - - -    - - - - + + + + + + + +    + + + + - - - - - - 'display_name', - 'order' => 'ASC', - 'fields' => array( 'display_name', 'ID'), - ); - $authors = get_users( $args ); - if( !empty($authors) ){ - ?> - - + + + + + + 'display_name', + 'order' => 'ASC', + 'fields' => array( 'display_name', 'ID'), + ); + $authors = get_users( $args ); + if( !empty($authors) ){ ?> - - - - - + + + + + + + + - - - - - - -

- -

- - - + + + + + + +

+ +

+ + + + + - +

+ +