I've created a custom Page Template that grabs all the attached media (images) to the page using get_attached_media().

I'm adding the media by clicking on Add Media button above page title.

If I delete everything from visual or text view, the attachments are still attached.

Is there any solution for that? For example a button in the WYSIWYG editor that removes all the attached media? Or any other solution?

Thanks in advance!

  • wordpress.org/plugins/unattach-and-re-attach-attachments Maybe that helps. – Tomás Cot Aug 23 '14 at 14:50
  • I'm not looking for a plugin, but thanks for your effort. Basically I want something like unattach all files by post/page ID or sth. – SLH Aug 23 '14 at 15:50
  • 1
    Sorry but I can't imaging why you expect the attachments be unattached if you delete the text from the post. An attach it is not the content of the post. Attachment and post are two independent elements that goes together, that is the meaning of "attachment". If you want break that relationship you have to delete the attachment or to delete the post. Currently the is not "unattach" functionality from the post editor UI so you need to use a plugin or code the functionality at your own. – cybmeta Aug 23 '14 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.