Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Use wp_delete_attachment

<?php wp_delete_attachment( $attachment_id ); ?>
share|improve this answer
    
Thanks mate, how could I miss this >.< –  mcometa Nov 5 '12 at 8:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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