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.
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.
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:
https://website-url.com/wp-admin/post.php?post=66&action=edit
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.
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:
https://website-url.com/wp-admin/post.php?post=7&action=edit
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 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.
Another solution to this problem is the use of plugins. You can search for any page or post ID plugins 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 plugin Show Pages IDs.
Final Thoughts
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.
No comments:
Post a Comment