How to Get the Post ID in WordPress?
While working on the WordPress, you may come across different situations in which plugins asks you for the Post ID. In WordPress, each post has its Unique ID which helps to identify the particular post in the WordPress Database.
Sometimes, You might need to get the Post ID, either for a plugin or as a Developer you need to query it. Mostly Post Id is used in WordPress Plugins and Themes to filter posts or exclude them and also request Post ID during the configuration process.
You can easily find out the URL by searching the name of the post but, there are different ways to get the Post ID that are:
Method 1) Find Post ID with Mouse Hover
You can find Post ID through the WordPress Dashboard which is the easiest and the fastest way of getting it. You need to follow the following steps:
1. Firstly, you have to Login to your WordPress Dashboard as Admin.
2. Click on Posts >> All Posts.
3. Move the mouse over the title of a post then see the Post ID shown in the browser status bar.
You see Post Id is the number that comes after the “post=” and before the “&” in the small box.
In the bottom left corner, you can see the small grey box that shows in the above picture. For the first time, the Post Id is “1”.
Method 2) Find Post ID in URL on the Post Edit Page.
The Post ID is also visible in the URL of every single Post. You have to edit the Post in WordPress Dashboard. You need to follow the following steps:
1. Firstly, You have to Login to your WordPress Dashboard and click on the Posts Menu.
2. Click on the Post whose Id you are looking, then click on Edit.
3. Then the Post will open in your Post Editor and now you able to see the Post Id in your Browser Address Bar.
You can see the Post Id between the “&” and “post=” in number. Both of the above methods are not time-consuming. You can find the Post Id in a second whether you are not well known to the WordPress.
How to find Page ID, Comment ID and Tags ID in WordPress?
Just like Post on your site, You can use the same method to find out the ID of the Page, Comment, Tags ID. You have to follow the same procedure. Just visit the Edit screen of the Dashboard and Locate the ID Number shown in the URL.