Demo Features How It Works Pricing FAQ Contact Log in Get Pro →
WordPress Guide

How to Attach Unattached Images
in WordPress — Automatically

Unattached images clutter your media library, leave orphaned files on your server, and create empty pages that hurt your SEO. Here's what's happening, why it matters, and how to fix it automatically.

📅 Updated June 2025 ⏱ 8 min read 🏷 WordPress, SEO, Media Library
The basics

What are unattached images in WordPress?

Every file you upload in WordPress is stored as a special post type called an attachment. Each attachment has a post_parent field that tells WordPress which post or page it belongs to.

When you upload an image directly inside a post editor, WordPress sets that field to the ID of the current post — the image is attached. When you upload images through the media library independently, or import them in bulk, that field stays at 0. That's an unattached image.

wp_posts — attachment records
ID  post_type    post_parent   post_title ────────────────────────────────────────────────── 412 attachment   398         product-hero.jpg ← attached ✓ 413 attachment   0           banner-2024.jpg  ← unattached ✗ 414 attachment   0           team-photo.png   ← unattached ✗

Unattached images still display on your site — the files exist and load fine. But without a post_parent, WordPress has no record of where they belong. This seemingly minor gap has real consequences.

Why it matters

Why you should attach images to their parent post

Deleting a post removes attached images automatically

This is the biggest practical benefit. When a post is deleted and its images are properly attached, WordPress deletes those image files from the server too. No orphaned files, no wasted disk space.

⚠️
Unattached images survive post deletion

If your images have post_parent = 0, deleting their parent post leaves every image file on your server indefinitely. On a large site with years of deleted posts, this adds up to gigabytes of wasted storage with no way to clean it up automatically.

Better media library organisation

WordPress's media library has a built-in filter for "Attached" vs "Unattached" items. When images are properly linked, you can find every image belonging to a specific post, keep your library clean, and avoid accidentally reusing images from deleted content.

More accurate SEO signals

When WordPress knows which post an image belongs to, SEO plugins like Yoast, Rank Math, and All in One SEO can use that relationship to generate more accurate structured data, sitemap entries, and image metadata. An unattached image is a floating file with no context and no SEO benefit.

Attachment pages have a parent to point to

Every uploaded image automatically gets its own WordPress URL — an attachment page. If the image is unattached, that page has no parent to reference and no meaningful content to display.

✅
The rule of thumb

Every image that appears in a post, product, or download should have that post as its post_parent. Attaching images is how WordPress was designed to work.

SEO impact

The problem with WordPress attachment pages

By default, WordPress generates a unique URL for every image you upload. If your site has 1,200 product images, you have 1,200 attachment page URLs — each containing little more than the image itself and a title.

🔍
Google may index these pages

Attachment pages are publicly accessible by default. Google crawls and indexes them. Hundreds of thin, near-duplicate pages can dilute your crawl budget and introduce low-quality content signals that drag down your overall rankings.

There are two accepted solutions:

  1. Redirect them — use a 301 redirect to send visitors to the parent post. Passes full SEO link equity to the parent.
  2. Enrich them — display the parent post title, author, price, and a purchase button on the attachment page itself. Turns a thin page into a useful landing page.

Both strategies require the image to be properly attached first. You can't redirect to a parent post that doesn't exist in the database.

The hard way

How to attach images manually (and why it doesn't scale)

WordPress does let you manually set a parent for individual attachments. Here's how:

1

Open the Media Library

Go to Media → Library in your WordPress admin and switch to List View.

2

Filter by "Unattached"

Use the dropdown filter at the top to show only unattached items.

3

Click "Attach" on each image

Each unattached image has an "Attach" link. Click it, search for the correct post, confirm. Repeat for every single image.

⏱
Not practical at scale

If you have 50 unattached images the manual process takes 20 minutes. If you have 500 — or 5,000 — it becomes a full-day project with a high risk of wrong matches. And it won't help with images uploaded in the future.

The smart way

Attach images automatically with a plugin

Attach Unattached Images solves this automatically. Install it, choose your post types, and start a scan. The plugin reads your post content, finds every image URL referenced, and sets the correct post_parent on each attachment — without touching the files themselves.

Supported post types

📝

Posts

Default WordPress blog posts. Scans content and excerpt fields.

🛍️

Products

WooCommerce product posts including gallery and content images.

⬇️

Downloads

Easy Digital Downloads (EDD) download post type, fully supported.

How to set it up

1

Install the plugin

Search for "Attach Unattached Images" in Plugins → Add New, or download it from AttachImages.com.

2

Go to Settings → Attach Unattached Images

The plugin adds a page under the WordPress Settings menu — no cluttered top-level admin item.

3

Choose post types and scan fields

Select Posts, Products, Downloads, or any combination. Choose to scan post content, post excerpt, or both.

4

Click Start Scan

A live progress bar tracks every batch. Pause and resume at any point — your position is saved between sessions.

5

Done

Every image found in your content is now formally attached to its parent post.

⚡
Batch processing — no PHP timeouts

The plugin processes posts in configurable batches so it never hits PHP's max execution time, even on sites with tens of thousands of posts.

Plans

Free vs Pro — what's the difference?

The free version on WordPress.org handles unlimited posts with no PHP timeouts. Pro adds background processing, a 10× speed boost, auto-attach on save, and the attachment page builder.

Feature Free Pro
Scan Posts, Products & Downloads ✓ ✓
Scan post content / excerpt ✓ ✓
Live progress bar + pause & resume ✓ ✓
Attachment page 301 redirector ✓ ✓
Background scanning (close browser anytime) – ✓
10× faster scanning engine – ✓
Auto-attach on post save – ✓
Attachment page builder – ✓
Parent post sidebar (title, author, price) – ✓
WooCommerce price + buy button on attachment page – ✓

Why is Pro 10× faster?

The free version processes one batch at a time, waiting for each server response before starting the next. Pro uses a parallel async queue and a dedicated background task runner via WordPress cron — multiple batches run simultaneously and the browser doesn't need to stay open. On a site with 5,000 posts, that's the difference between a 2-hour scan and a 10-minute one.

Free
$0
Forever free · WordPress.org
  • Scan Posts, Products & Downloads
  • Batch processing, no PHP timeouts
  • Live progress bar, pause & resume
  • Attachment page 301 redirector
  • Background scanning
  • Auto-attach on save
  • Attachment page builder
Download Free
Pro feature

Transform attachment pages into rich, SEO-boosted content

Instead of leaving attachment pages bare — or redirecting visitors away — Pro gives you a third option: turn them into genuinely useful landing pages that convert image search traffic into real engagement.

yoursite.com/?attachment_id=413
Attached product image — wireless headphones
Parent post featured image
Parent post
Wireless Noise-Cancelling Headphones — Full Review & Buy Guide
JR
Jake Rivera 12 June 2025
Price
$149
product-hero-shot.jpg · 2400×1600px · JPEG See live demo →

Every element is toggleable from the plugin settings — parent post title, author, price (WooCommerce or EDD), a purchase button, and image metadata. See the live attachment page demo →

💡
Why this matters for Google Image Search

Google Images drives real traffic. When a user clicks through from an image result they land on your attachment page. With a default bare page they bounce immediately. With a Pro-enriched page showing the product title and a buy button, that click becomes a potential conversion.

SEO strategy

Should you redirect attachment pages?

Yes — unless you're actively enriching them with the Pro attachment page builder.

WordPress attachment pages in their default state are among the most common sources of thin content on WordPress sites. They render a single image, a title, and nothing else. Google considers pages with little added value to be low-quality, and indexing hundreds of them can hurt your overall domain quality signals.

How the 301 redirector works

Enable the Attachment Page Redirector in the plugin settings. Any visitor — human or bot — who lands on an attachment URL is automatically sent to the parent post with a 301 permanent redirect.

📈
Why 301, not 302?

A 301 tells search engines the move is permanent. They transfer link equity from the attachment page to the parent post and remove the attachment URL from their index over time. A 302 (temporary) redirect does not pass full SEO value and keeps the attachment URL indexed.

Note: the redirector only works when the image is properly attached and has a valid parent. This is another reason attaching images is the critical first step — without a post_parent there is no destination to redirect to.


Questions

Frequently asked questions

Will the plugin move or delete any image files?

No. The plugin only updates the post_parent field on existing attachment records. No files are moved, renamed, reuploaded, or deleted. The operation is fully reversible.

What happens in the Free version if I close the browser mid-scan?

The scan stops at the current batch, but your progress is saved. When you reopen the settings page you can resume from exactly where it left off. Upgrade to Pro for true background processing via WordPress cron — the scan continues even after you close the browser.

Does it work with WooCommerce product galleries?

Yes. Select "Product" as your post type. The plugin scans image URLs from product content fields and attaches them to the correct product. Pro's attachment page builder can also display the WooCommerce product price and a buy button on the attachment page.

Does it support Easy Digital Downloads?

Yes. Select "Download" as your post type. The plugin is fully compatible with EDD and was built partly with EDD stores in mind.

Is there a limit on how many posts can be scanned?

No. Batch processing means the plugin handles any number of posts without hitting PHP memory or timeout limits. The only practical difference between Free and Pro is speed — Pro's parallel engine is around 10× faster.

Does redirecting attachment pages hurt my SEO?

Quite the opposite. Redirecting thin attachment pages consolidates link equity to the parent post, removes low-value pages from Google's index over time, and improves your site's overall content quality signals. Most SEO plugins recommend either redirecting or noindexing attachment pages for exactly this reason.

Get started

Fix your unattached images today

The free version handles unlimited posts with no PHP timeouts. Install it in two minutes and run your first scan straight away.