How To Get Post ID, Cat ID in WordPress?

Each time you publish a post and assign a category to it, WordPress by default add a unique ID number to each posts and category you have published. This unique ID number makes it easy for WordPress system to identify your each blog posts and categories.

Some of the WordPress themes also utilizes this post ID and cat ID number for their functions to run.

How Can I Know post ID number for my posts?

To know the post ID number of your posts navigate to WP Dashboard > Posts > All Posts, and hover your mouse cursor over the post for which you want to know the post ID number.

When you hover over the post a little box appear in the bottom-left corner of the screen, which contains the post ID number of that post.


Here in the screenshot toward the end of the URL, you can see a bit of text that says “post=117“.
This tells us the post ID number. This particular post has a unique ID number of “117“.

How To Get Cat ID?

To get the cat ID number process is same as above, all you have to do is to navigate to the WP Dashboard > Categories, hover over the category and a little box will appear in bottom-left corner of the screen.