This post was last updated on 6/16/2018
An ID is a unique number allocated to a specific item in your database. Unfortunately, WordPress doesn’t make it so easy to find that ID, which, at some point, you will need.
You will mostly need it when wanting to exclude a plugin’s features from some pages, posts, categories, etc.
Let’s take one of the most popular plugins, Yoast SEO, as a quick example.
In the past, if you wanted to remove a page or a post from your XML sitemap, you would go into that post or page, select the “Advanced” tab from the Yoast meta box, and choose “Never include” from the “Include in Sitemap” drop-down menu.
After the plugin’s recent updates, if you want to exclude a page or post from your sitemap, you’ll need to go to SEO -> XML Sitemaps -> Excluded Posts and insert the IDs:
Update (6/16/2018): Things have changed a bit with the last Yoast versions. Now, to exclude something from the XML sitemap, you’ll have to go to SEO -> Search Appearance -> Select No under Show … in search results?
Now let’s get to the important part!
How to find a page or post ID
To find a page ID, first you need to go to Pages -> All Pages.
Once there, search for the page whose ID you’re looking for, and hover your mouse cursor over the “Edit” link (don’t click on it) found under its title.
Now, look at the bottom-left of your screen, where a link should appear:
As you can see, the page’s ID, which is 121, appears there!
Do the same thing to find the ID of a post, except you need to go to Posts -> All Posts, of course.
How to find a category or tag ID
The “Categories” and “Tags” sections are found under “All Posts”. I’ll only use categories as an example since for tags it’s basically the same thing.
So, once you’re in the category area, search for the category whose ID you want to find out, and hover your cursor over the “Edit” link found under its title. As you can see, it’s the same process as the above one.
Once you’ve done that, a link should appear at the bottom-left of your screen, containing the category’s ID:
In this case, the category ID is 1.
How to find a comment ID
For this part, you need to access the “Comments” area.
Just like in the above examples, find the comment whose ID you need, hover your cursor on the “Edit” link, and get the ID that appears in the link at the bottom-left of your screen:
In this case, the comment ID is 2.
If that doesn’t work…
If somehow the link doesn’t appear at the bottom of your screen, then you have to click on the “Edit” link, not just hover your cursor over it, so you can enter the editing area.
After you clicked on “Edit”, look at the link in your browser’s address bar. There you will find the ID.
For this post, the ID is 82, as you can see.
The easiest way – use a plugin
This Reveal IDs plugin will make things a lot easier, especially if you need the IDs of a lot of pages, posts, categories, tags or comments. It doesn’t require configuration, you just install it and you’re done!
You shouldn’t install it if you just need a few IDs, though, because the fewer plugins you have installed, the better.
That’s a wrap
Hope this post has helped you guys out with the WordPress IDs issue.
If you have anything to say or ask, please drop a comment!
Unfortunately this code didnt work for me. The plugins are not suitable either :(
What code?