I want to remove the original file after uploading. Same issue as here:
Link: Forum Link
While searching for a solution I found a function to filter/hook in into the process:
add_filter( 'wp_generate_attachment_metadata', 'delete_fullsize_image' );
function delete_fullsize_image( $metadata )
$upload_dir = wp_upload_dir();
$full_image_path = trailingslashit( $upload_dir['basedir'] ) . $metadata['file'];
$deleted = unlink( $full_image_path );
This doesn´t work for me (code placed in functions.php). I founded calls to the filter many times in the plugin-files.
Can you please give me a fast solution for deleting the original files, which even works for upcoming updates for your plugin?