'attachment', 'post_mime_type' => 'text/csv', 'post_status' => 'inherit', 'posts_per_page' => -1 ); $old_csv_files = new WP_Query( $args_old_csv ); echo '
'; echo '

' . __( 'CSV uploaded', 'import-users-from-csv-with-meta' ) . '

'; if( $old_csv_files->found_posts == 0 ){ ?>

'attachment', 'post_mime_type' => 'text/csv', 'post_status' => 'inherit', 'posts_per_page' => -1 ); $old_csv_files = new WP_Query( $args_old_csv ); $result = 1; while($old_csv_files->have_posts()) : $old_csv_files->the_post(); $mime_type = (string) get_post_mime_type( get_the_ID() ); if( $mime_type != 'text/csv' ) wp_die( __('This plugin can only delete the type of file it manages, i.e. CSV files.', 'import-users-from-csv-with-meta' ) ); if( wp_delete_attachment( get_the_ID(), true ) === false ) $result = 0; endwhile; wp_reset_postdata(); echo $result; wp_die(); } } $acui_csv_uploaded = new ACUI_CSV_Uploaded(); $acui_csv_uploaded->hooks();