I’m having a trouble un-attaching media from a post without deleting it entirely from my site. Is there a simple way to unattach an image from a post for instance?
Leave a Reply
You must be logged in to post a comment.
I’m having a trouble un-attaching media from a post without deleting it entirely from my site. Is there a simple way to unattach an image from a post for instance?
You must be logged in to post a comment.
I learned from Brian Fegter that you can Un-attach an image from a post while participating in this question:
Can I attach an image to a different post?
It isn’t exactly “simple”, but not to difficult. It’s the only solution I’ve been able to find.
Is this what you’re looking for?
e.g. Remove all image attachments from a post
However, please take note of the caution when using wp_update_post.
Alternate method using $wpdb
As of WordPress 4.2 this functionality is built in. Click the
Detach
link in media list view.For older versions, there’s a plugin which does the same thing: https://wordpress.org/plugins/unattach/