WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In buddypress when a user wants to delete their own account --> is possible to delete all their attachments entries and images uploaded using media?

Note: Images are not attached to posts, because im not letting users create normal posts, they only can upload images using media.

Thanks in advance.

share|improve this question
what about the posts to which they were attached? or the posts which the author wrote? any connection in between them? – Ashfame May 1 '11 at 16:32
No, thats not a problem in my case, because im not letting users create normal posts only upload images. – José Pablo Orozco Marín May 1 '11 at 23:04
It can be done by hooking on to the hook for deleting the user, where we would fetch the attachment IDs and then call wp delete attachment for each of them. If there are quite a good number of images per user, a direct query would be better in terms of performance. – Ashfame May 2 '11 at 6:48
up vote 1 down vote accepted

As media uploads are simly files with no related data stored, you can't do that unless you extend the user data and save the file names, etc. as user meta data. Simple answer: No, it doesn't work.

share|improve this answer

Your Answer


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.