WordPress is a popular CMS that you can use to create and publish thousands of posts. SO how does WordPress uniquely identify all these posts? It does this with the help of IDs.
Every post and page that you create in wordpress will have their own unique ID. Every piece of content on WordPress gets its own ID. This includes metadata such as categories and tags, as well as any uploaded images.
In this post, we will show you how to quickly find the ID of any WordPress post or page.
Find the ID of any WordPress Post
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.
!
https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/2803/posts/93324/image-upload/wordpress_post_list.png
You can then click on either the post title or the
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.
Find the ID of any WordPress Page
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.
!
https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/2803/posts/93324/image-upload/wordpress_page_list.png
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.
Quickly Finding the ID of Multiple Posts or Pages
Let’s say you are looking for the ID of ten 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.
Another solution to this problem is to use a plugin. You can search for any page or post ID plugin in the
WordPress plugin directory. Two plugins that I found to be useful are the
Show Pages IDs plugin and the
Catch IDs plugin. Both of them will show you the ID of all the pages, posts, comments, media elements, categories, and tags in the admin area.
Here is a screenshot from the
Pages > All Pages screen after installing the Show Pages IDs plugin.
!
https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/2803/posts/93324/image-upload/page_post_ids.png
Final Thoughts
In this quick tip, you 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 the
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 IDs of different pages.