How to unattach media images from a WordPress post

Published on: Updated: March 26, 2018

The WordPress media library works in some funny ways! When you upload an image or other media file (e.g. a video or audio file) from a page or post, WordPress automatically attaches the image to the page or post behind the scenes. This can be used for various functions, for example:

  • The WordPress gallery shortcode
  • Some themes automatically display all the images that are attached to a particular page or post – for example to create a slideshow or gallery

Surprisingly, it’s a lot less obvious how to break the attachment between a WordPress page/post and its images! In this article, I show you two simple ways of doing this.

The following methods work for standard WordPress posts, pages and custom post types.

Method 1 – Just delete it!

The simplest way to unattach an image or other media file from a WordPress post is to delete it. You can delete either the media file or the WordPress post itself, and the link will be broken.

However I understand that you may not want to do this. For example, there are times when you don’t know if an image is attached to more than one post or page. You don’t want to risk deleting it in case it’s also being used elsewhere. Modern WordPress themes display images and other media files in so many different ways that there’s no simple way of seeing where a particular image is being used.

Method 2 – Unattach it

Although WordPress itself does not let you unattach media from posts, you can achieve this by installing the WordPress Unattach plugin. This very simple free plugin adds an option allowing you to detach any media file. Simply install it and then go to the Media page in the WordPress admin, hover over the image you wish to unattach, and select the ‘Detach’ option.

As always, I would only recommend installing a plugin if you have a genuine need to do so. As a professional WordPress web design agency, we like to keep our sites simple and streamlined – and recommend that you do too. However, this is a handy (and well reviewed) plugin if you will find it useful.

Filed under: WordPress Web Design