WordPress is a pretty popular CMS that you can use to create and publish thousands of posts. How does WordPress uniquely identify all these posts? It does so with the help of IDs.
All pages and posts that you create in WordPress will have their own unique ID. The IDs are not limited to just posts and pages though. Every piece of content on WordPress gets is own ID. This includes meta data such as categories and tags as well as any uploaded images.
In this post, I will show you how to quickly find out the ID of any WordPress post or page.
First, we will head over to a list of all the posts on our website by navigating to Posts > All Posts from the WordPress admin dashboard. As you can see, this will show you a list of all the private and public posts on the website, provided you are logged in as an editor or administrator.
You can then click on either the post title or Edit button that appears when you hover over the post entry. This will take you to a new webpage where the URL structure will look something like this:
Did you notice the word post in the above URL? That is a query string parameter. The value of post is the ID of the post that you clicked. In my case, the ID of the post titled “My Recent Trip” is 66.
You can find the ID of any WordPress page in the same manner that you used to find the post ID. First, you need to go to Pages > All Pages from the WordPress admin dashboard.
You can now either click on the page title or the Edit button in order to navigate to the Edit page screen. At this point, the URL in the browser should look something like this:
Again, you can see that there is a query string parameter called post in the URL. The name of the parameter stays post even if you are editing pages. The value of the post parameter in this case is 7. This means that the ID of the “Cart” page is also 7.
Let’s say you are looking for the ID of 10 different posts or pages. In this case, it doesn’t make sense to open up all of them in the browser and check the ID. You actually don’t have to click on all these links. Just hover over them and almost all browsers will display the URL that these links are pointing to in the bottom left corner.
Here is a screenshot from the Pages > All Pages screen after installing the plugin Show Pages IDs.
In this quick tip, we learned how to easily find out the ID of different WordPress posts and pages. You can just hover over the post or page titles and check the value of page query parameter if you only want the ID of a few pages. However, installing a plugin will save you more time in the long run if you frequently need to find the ID of different pages.