WordPress Post ID and Permalink Finder
Enter a WordPress page or post URL to find its numeric post ID — read from the page's postid- body class, or its shortlink as a fallback. Useful for shortcodes, widgets, menus, and redirects.
Instructions
- Paste the post URL — enter the full URL of the WordPress post or page you want the ID for into the field above.
- Click "Get Post ID" — the tool fetches that page and reads its markup.
- Read the result — you get the numeric post ID and the matching
?p=permalink, likehttps://trevorfox.com/?p=3086.
The page is fetched server-side and parsed as text, so it works on any public WordPress URL without a login, an API key, or a plugin. Nothing is stored.
How to find a WordPress post ID manually
To check a post ID by hand, navigate to the post on your site and view the page source. Look for the body tag and read its class attribute — WordPress themes print a class containing postid- followed by the number:
<body class="post-template-default single single-post postid-3086 ...">
Alternatively, if you are logged in with edit rights, open the post in the editor and read the ID out of the URL bar, where it appears as ?post=ID.
This tool automates the first method. It fetches the HTML for you and searches it for the ID, so you don't have to scroll through the source of a page looking for the right attribute on a phone or in a cramped view-source tab.
Where the ID comes from
The tool checks two places in the delivered HTML, in this order, and returns the first ID it finds:
| Source | What it looks like | Notes |
|---|---|---|
body class | class="... postid-3086 ..." | Printed by body_class(), which nearly every theme calls. Checked first. |
| Shortlink tag | <link rel="shortlink" href="https://example.com/?p=3086"> | Emitted in head by WordPress core. Used as the fallback. |
If neither is present, you get a "couldn't find a post ID" message rather than a guess. That usually means the URL points at an archive, a category page, or the homepage rather than a single post — or that the theme suppresses the body class and the site has disabled shortlinks. Note that the fetch is anonymous, so a URL that requires a login returns whatever a logged-out visitor sees, which will not carry the post's ID.
About the ?p= permalink
Once the ID is known, the permalink is just the site origin plus /?p= and the number. That form works no matter what permalink structure a site uses — pretty URLs, dates, post names — because WordPress resolves ?p= directly against the post ID and redirects to the canonical URL. It is a handy way to confirm an ID actually belongs to the post you think it does: open the ?p= link and see where you land.
Making WordPress management easier one ID at a time
It's common for non-developers and developers alike to need a WordPress post ID. These numeric identifiers are essential to everyday WordPress tasks. Some shortcodes require post IDs to display specific content within another post or page. Similarly, configuring widgets that display content from a particular post, or setting up custom menu items that link to specific posts, typically requires the post ID.
In addition, various plugin settings might ask for post IDs. SEO plugins may need them to customize settings for individual posts, while redirection plugins require post IDs to set up 301 redirects or other types of redirects for specific posts. If you write custom queries, WP_Query arguments like p, page_id, post__in, and post__not_in all take IDs rather than titles or slugs — and in the loop, the ID is what get_the_ID() and $post->ID hand you.
Having easy access to a post's ID also makes it easier to organize and reference specific posts in your documentation or content strategy. A title can be rewritten and a slug can be changed, but the ID is stable for the life of the post, which makes it the safest thing to key a spreadsheet, a migration map, or a redirect table on.
I hope this makes your life a little bit easier.
You also might find the WordPress Category ID finder, WordPress Tag ID finder, and the WordPress User ID finder useful.
These tools are how Elegant Atomics thinks about growth for B2B SaaS. Work with us. Work with us →