What Is an Attachment in WordPress?
An attachment in WordPress is a media file, such as an image, video, audio file, or PDF, uploaded to the Media Library. WordPress stores every upload as an entry of its built-in attachment post type. A file counts as “attached” when a post or page is recorded as its parent, which happens when you upload from the editor.
More About Attachments
Attachments can be images, videos, audio files, PDFs, and other documents. In WordPress, every upload is stored as an entry of the built-in attachment post type, a piece of content in its own right with its own title, details, and URL, alongside your posts and pages. Your theme controls how attachments are displayed, but files are never attached to the theme itself.
"Attached" has a narrower meaning than you might expect. A file is attached when WordPress records a post or page as its parent, and that happens automatically when you upload the file from the post or page editing screen. Upload it straight to the Media Library instead (Media > Add New) and it stays unattached. Inserting a library file into content later is a separate action: it embeds the file where you want it, but it doesn't reliably set that post as the parent. To put the relationship on record, use the Attach option in the Media Library's list view.
Unattached files build up over time and clutter the library. To see which files are unattached, go to Media > Library and set the "All media items" dropdown to "Unattached." To check what a file is attached to, click it: the Attachment Details panel's "Uploaded to" field names the parent post or page, and that field doesn't appear for unattached files. Our guide to the WordPress Media Library covers cleanup and organization step by step.
Where WordPress stores attachments
Every upload becomes an item in the Media Library, and the file itself lands in your site's uploads directory on the server, wp-content/uploads by default. The one folder choice you get under Settings > Media, covered in our media settings entry, is whether to organize uploads into month- and year-based folders, so a file uploaded in August 2026 goes to wp-content/uploads/2026/08. The screen doesn't move the base directory itself.
Each attachment also carries its own editable details: a title, caption, alt text (for images), and description. You can edit all of them from the Attachment Details dialog, and any changes save automatically. Fill in alt text when you upload an image so you never have to hunt for missing descriptions later.
Attachment pages
An attachment page is a standalone page that WordPress generates to display a single media item at its own URL. When you insert a file into a post, you can leave it unlinked, link directly to the media file, or, on sites where attachment pages are enabled, link to the file's attachment page.
Since WordPress 6.4 (November 2023), attachment pages are fully disabled on new installations. A database option named wp_attachment_pages_enabled controls the behavior: new sites get 0, so attachment page URLs redirect to the media file itself, while sites that upgraded from an earlier version get 1 and keep their attachment pages. WordPress made the change because these pages rarely add meaningful information, yet they get indexed by search engines and sometimes even rank, sending searchers to a page that holds nothing but a file.
If your site predates 6.4, check whether your attachment pages are still live. Open a file in the Media Library: a "View attachment page" link means they're on (when they're off, the link reads "View Media File" instead). To turn them off, set the option to 0, for example with WP-CLI: wp option update wp_attachment_pages_enabled 0.
Frequently Asked Questions
- No. The attachments stay in the Media Library. If the deleted post had a parent, WordPress attaches the media to that parent; otherwise the file becomes unattached. To delete files for good, go to Media > Library, use Bulk Select, and click Delete Selected. That deletion is permanent.
- Images (JPEG, PNG, GIF, WebP), documents (PDF, DOC, DOCX), spreadsheets, audio (MP3, WAV), and video (MP4, MOV) are all accepted. WordPress rejects anything outside its permitted list, which is how risky uploads like PHP scripts get blocked. Maximum upload size depends on your host's settings.
- Effectively, yes. "Media item" is what the admin screens call a file in the Media Library, and "attachment" is the same object's technical name in the WordPress database. A file doesn't need a parent post to be an attachment. Unattached uploads are attachments too.
Powerful WordPress Hosting
Reliable, lightning-fast hosting solutions specifically optimized for WordPress. Find the perfect plan for you by clicking below.
WordPress Hosting Plans