How to Find an Image ID in WordPress
Many WordPress tasks ask for an image ID: gallery shortcodes, page builder settings, custom fields, theme options and code snippets. But WordPress doesn’t display IDs anywhere obvious in the Media Library. This guide shows you four quick ways to find an image ID in WordPress, plus a way to show IDs permanently so you never have to hunt for them again.
What Is an Image ID?
Every file you upload to the Media Library is stored as an attachment with a unique number, its ID. WordPress, themes and plugins use this number to fetch the image, its sizes and its alt text. For example:
echo wp_get_attachment_image( 214, 'large' );
Using the ID instead of a hard-coded URL means the image keeps working if you change domains, switch to a CDN or regenerate thumbnails.
Method 1: Find the ID in the Media Library List View
- Go to Media → Library.
- Click the list view icon at the top left.
- Hover over the image’s title or the Edit link.
- Look at the link preview at the bottom of your browser. It ends in
post.php?post=214&action=edit. - The number after
post=, here 214, is the image ID.
Method 2: Find the ID in the Grid View
- Go to Media → Library in grid view.
- Click an image to open Attachment details.
- Look at your browser’s address bar. It shows
upload.php?item=214. - The number after
item=is the ID.
Method 3: Find the ID From the Edit Media Screen
In Attachment details, click Edit more details. The full edit screen’s URL contains post=214, the same ID.
Method 4: Show an ID Column in the Media Library
If you look up IDs often, show them right in the Media Library list. Media ID Columns from Simpli Plugin is a free plugin that adds an ID column to your WordPress admin lists, so every image’s ID is visible at a glance.
- Download the plugin ZIP from its product page.
- Go to Plugins → Add New Plugin → Upload Plugin.
- Upload the file, click Install Now, then Activate Plugin.
- Open Media → Library in list view and look for the new ID column.
This is especially handy for developers, page builder users and anyone managing a large media library.
Building custom galleries, sliders or product layouts that rely on image IDs? Simpli Plugin’s team builds custom WordPress features and admin tools tailored to how your team works.
Where You’ll Use Image IDs
| Use | Example |
|---|---|
| Gallery shortcode | |
| Theme or template code | wp_get_attachment_image( 214, 'medium' ) |
| Custom fields (ACF and similar) | Image field stored as an ID |
| Page builder settings | Background or logo image selection |
| WooCommerce product gallery | Product image IDs in imports and exports |
How to Find Other IDs in WordPress
The same trick works across WordPress. Hover the Edit link and check the number:
- Posts and pages:
post.php?post=123 - Categories and tags:
term.php?taxonomy=category&tag_ID=5 - Users:
user-edit.php?user_id=2 - WooCommerce products: also
post.php?post=456, and the ID shows under the product name when you hover it in the product list
Common Problems
I Can’t See the Link Preview
Some browsers hide the status bar. Right-click the Edit link, copy the link address and paste it somewhere to read the number.
The Image Shows the Wrong Size
The ID refers to the whole attachment. Choose the size, such as thumbnail, medium, large or full, in the function or shortcode that displays it.
The ID Changed After Re-Uploading
Every upload creates a new attachment with a new ID. Update any shortcodes or settings that used the old ID.
Related Guides
- How to Add Alt Text to Images Automatically in WordPress
- How to Upload SVG Files to WordPress Safely
- How to Disable Emojis in WordPress
Frequently Asked Questions
Is the image ID the same as the file name?
No. The file name is what you uploaded, while the ID is the database number WordPress assigned to it.
Can two images have the same ID?
No. Every attachment, post and page on a site has its own unique ID.
Do image IDs change when I move my site?
Not with a normal full-site migration. They can change if you import content into a different site using an importer.
Does WordPress show IDs anywhere by default?
Only in URLs. A plugin like Media ID Columns adds a visible ID column to the admin.
Stop Hunting for Image IDs
Finding an image ID takes seconds once you know where to look: the edit link in list view, the item number in grid view or a dedicated ID column.
Download Media ID Columns for free, and browse the full Simpli Plugin library for more time-saving WordPress tools.