How to Get the WordPress Post ID Quickly and Easily

Home WordPress How to Get the WordPress Post ID Quickly and Easily

Do you want to find out how to get the WordPress post ID? Well, it’s quite simple and straight-forward!

To the regular WordPress user, the Post ID seems a bit too alien of a concept to comprehend. 

In regular cases, you won’t be using a WordPress Post ID. However, if you’re a WordPress developer, you might need a Post ID for a particular query or a plugin. In both cases, you’ll want access to the Post ID. 

In this post, we’ll be talking about how to get it and how you can utilize it for your process. 

Before we begin, however, let’s lay down some essential groundwork.

What’s a Blog Post ID in WordPress?

Similar to your SSN, every page and post type (custom and default) will have a unique identification number associated with it. This ID is directly connected with the WordPress database. 

This unique identification is used for a lot of different purposes. In a nutshell, its purpose is to help customize the WordPress experience. 

Where is the ID number located? 

When you develop or customize a WordPress theme or plugin, you will be asked to use a post ID or theme. These are usually required to filter posts or page elements. 

For example, some plugins let you remove the featured image from a WordPress post or hide certain widgets. In both cases, you will be using the post ID to exclude these functionalities. 

Comma-separated by post ID

Finding the ID number of the post is very easy. All you have to do is click on the posts section of any particular post. At the bottom of your web browser, you can see the post ID. 

posts section of any particular post

In this example, we see that the Post ID is 191.

We can also see the Post ID (or Page ID, to be precise) for a WordPress page in a similar manner. For example, the Page ID, in this case, is 106.

how to get wordpress post id

To copy the URL version of the WordPress Post ID, you can click on Edit, and in the URL bar, you will see the post ID. Again, this is the same for custom post types and WordPress pages. 

New call-to-action

How to Get Post ID from the WordPress Dashboard

In older WordPress versions, the post-ID’s were displayed side by side on the WordPress dashboard. But since WordPress 2.5+, such functionality is no longer supported. However, you can use a plugin to integrate that functionality on WordPress. 

Using a plugin called Show IDs, you can display the WordPress Post ID with each WordPress post.

plugin called Show IDs

A portable plugin, it is useful if you want to show all sorts of WordPress identification. 

show post id in wordpress dashboard

How to Find WordPress Post ID with Get Post ID Function

As a developer, if you want to run queries on a particular post ID, you can use this plugin to find the ID. 

On top of that, you can use the following PHP function: 

<?php the_ID(); ?>

Now, this function is used for a loop. If you don’t want to the display the numeric ID within a loop, you can use the following: 


An example of such a code would be something like this: 

function function_name() {

global $post;

$thePostID = $post->ID;


That’s it, that’s how you find out how to get the Post ID! While it is a short article, it’s an integral part of the WordPress developers’ workflow. 

Want to have your WordPress site developed? Contact Codup’s WordPress Development Services to get the best developers for your next big project. 

Read Also

Tooba Nadeem

Tooba Nadeem is an experienced technical writer with 5 years of expertise in technical writing. Her extensive research and knowledge enable her to provide comprehensive insights into various interesting topics. She excels at presenting complex information in simplified language, ensuring clarity for the audience.

Leave a Comment

Your email address will not be published. Required fields are marked *