WinningWP content is free to all. If you make a purchase through referral links on our site, we earn a commission (learn more).

How to find page, post, category and tag IDs in WordPress

WordPress Deals

Although not very often, there’ll be times when you’ll want to know a specific ID of a WordPress page, post, category or tag – such as when you’re trying to write a piece of conditional code or a particular plugin (or even theme) you’re using requires you to enter it. Unfortunately, although it once did, WordPress no longer displays this piece of sometimes important information in the dashboard – meaning countless newbie-WordPress-users are left hunting high and low for it if/when the need to know it finally arises (most of whom will likely as not end up turning to Google and typing something like ‘Where can you find page IDs in WordPress’).

Luckily, there is, in fact, an extremely straight-forward way to access this particular piece of sneaky-WordPress information with ease – without having to install ANY extra plugins*!

Here’s how (note: we’ll go through the process for page IDs, but you can use exactly the same process to find IDs for categories, tags, posts and even media files):

Step 1.

Navigate to ‘Pages’ -> ‘All Pages’, and then click on the specific page for which you’d like to find the ID of. In this example we’ll choose ‘Sample Page’ (since it’s the only page in the menu in our install).

Sample Page Screenshot

(click to enlarge)

Step 2.

Once you’re in the edit page, take a look at the web address (URL) in your browser’s navigation bar and you should see something like “http://yourdomainname.com/wp-admin/post.php?post=2&action=edit” (or alternatively, if you’re using a browser like Firefox, which will show the web address of a page simply by hovering over a link, you’ll be able to skip this particular step altogether and view the same web address by simply hovering over one of the page titles – such as, in our case: ‘Sample Page’ – mentioned in step 1).

Step 3.

Take a good look at the web address found in step 3. See the bit that reads “post=2“**? …the “2” is the ID! I.e. the ID of this particular page is 2.

Screenshot showing WordPress Page ID in URL

(click to enlarge)

Simple!

*start installing plugins for simple tasks like this and before you know it you’ve got more plugins than you know what to do with and a WordPress install that’s both a pain to manage (more plugins = more updates, etc) and as slow as a snail stuck in super glue!

**note: for categories and tags, the ID will come immediately after “tag_ID=” (rather than “post=”).

…the only hard part is remembering how to do it when you need to!

By Brin Wilson

Founder of WinningWP - passionate about all things WordPress! Find me on Twitter.
Comments (policy)
  1. Ionuț Staicu says:

    Let me present you a plugin that I wrote couple of years ago or so that does one nice thing: it extracts page id’s: http://wordpress.org/plugins/get-page-ids/

    Since the plugin doesn’t interact in any other places other than its own page, it won’t affect performance in any way. Also, since the plugin just works, it won’t need an update unless there is some major change on WordPress core that broke the functionality :)

    Anyhow, instead of encouraging this kind of practices, please promote a more user friendly approach, like an admin page that allows you to set these IDs by simply selecting the correct Tag, Page or whatever.

Leave a Reply

Your email address will not be published. Required fields are marked *

All comments are held for moderation. We'll only publish comments that are on topic and adhere to our Commenting Policy.