I did a custom user profile page for wordpress that lets you update your profile including uploading your custom avatar and save that photo to the Media Library. Is there a way for the a specific avatar to be deleted using it's attachment ID?

1 Answer 1


Use wp_delete_attachment

<?php wp_delete_attachment( $attachment_id ); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.