For the plugin you need to make the function to clean the database.
Made the removal of posts:
$q = new WP_Query( ['posts_per_page' => -1, 'post_type' => 'post' ] ); if($q->have_posts()) while($q->have_posts()){ $q->the_post(); wp_delete_post($q->post->ID, true); } wp_reset_postdata(); But while the media files remain.
There is a function wp_delete_attachment() , but I don’t know how to get the id all media files stored in the database.