How to Get Page ID and Post ID

How to Get Page and Post ID

Every now and again it would be convenient to know the ID of a post or page in WordPress, right?Whether it’s a shortcode, when setting something up in the theme settings, or maybe just to get a quick link. I think you all must be not aware of this thing. Don’t know how to Get Page ID and Post ID? But don’t worry Today in this article I will explain to you how easily you can find your Post and page ID’s for the various pieces of content on your WordPress website, as well as some general ways in which you can use those IDs on your site.

Why it is important to Get Page ID, Post ID

Before Jumping directly into the topic let us first understand why Post and Page ID’s are important for your website.

You may not know it, but WordPress gives every piece of content on your site its own unique ID number.Without getting too much into a database structure, let’s just say that this helps WordPress keep track of all the different pieces of content on your site.

” Whenever WordPress needs to serve up content, it uses the ID number to find each specific piece of content. Which means that if you want to query/target specific content, it can be handy to know how to find WordPress page and post IDs”.

I hope you got the idea why it is so important to have your Post and page ID’s. Now without wasting, any time let us move on the topic.

How to Get Page ID and Post ID

It is very simple process a bit indirect. The ID is visible in the URL of every single post or page when you edit a piece of content in your WordPress dashboard.

First, you need to Login to your site and then visit the Post in your admin dashboard. Then, click on the Posts > All Posts.

In all post section, you will see the posts. Go to one post click on Edit option, there will you the WordPress Editor, look for the number in the actual URL of the page you’re on. For posts, you should see post=NUMBER. That NUMBER is the post id:

Like as you see in the given below image.

Get Page ID, Post ID
Post ID

the post ID is 10. Simple enough, right?

Similarity you do this with Page also to detect it’s Id.

login to your site and visit the Pages menu in your admin dashboard. Then, click on the Page that you need an ID for.

Now in the edit screen, look at the URL in your web browser.

how to Get Page ID, Post ID
Page ID

The Page ID is the number in the URL. This URL tells us that the Page being edited has an ID number of 38.

How to Find media, category and Tag’s Id’s

Just like Post and Page ID’s you can find ids for Media, Categories, and Tages. Let us check out how?

This process pretty much similar the which I have mentioned above.

  • Edit the item you want to find the ID for whether it is for Category, media or tag.
  • Look for the number in the URL you see in your screen.

For example, here’s what it looks like to find the ID for a category:

how to Get Page ID, Post ID
Category ID

Here’s what it looks like to find the ID for a media Galley:

how to Get Page ID, Post ID
Media Gallery ID

Show your Id by using Plugin

If you need to work on Post and page id’s on regular basis, then I found one of the best plugin for finding id’s quickly and quite easily.

The plugin name is catch IDs . As the name suggests it is a simple and lightweight plugin to show the Post ID, Page ID, Media ID, Links ID, Category ID, Tag ID and User ID in the Admin Section Table. With 100,000+ installations this coming in demand day by day. It is absolutely free. You can simply download it from WordPress.org.

There’s also nothing to configure – all you need to do is install and activate the plugin. Then, you’ll see a new id column in your WordPress dashboard interface just like is have shown in the image below.

how to Get Page ID, Post ID
Catch ID plugin

Yes, one thing more if you want to hide the column for certain types of content, you can use the built-in Screen Options to hide it.

First, click to open the Screen Options, then quickly uncheck the box for ID:

Post and Page ID's
Enabling ID option

Final Thoughts

If you’re struggling to configure a theme or use a plugin because you can’t find a post ID, I hope this short tutorial has helped you out. Even I’m pretty much clear to you.

well. it was a quite simple DIY process, anyone can easily do it. Those WordPress users won’t know how to how to Get Page ID and Post ID, simply because it’s so rarely needed. I hope now you will remember this process. For any query please feel free to comment below. Thanks for reading.

You can also check out these links to get into more detail-

Catch ID Plugin

How to find and display an ID in WordPress using plugin

Facebook
Twitter
LinkedIn
Pinterest

Newsletter

Get tips, product updates, and discounts straight to your inbox.

Hidden

Name
Privacy(Required)
This field is for validation purposes and should be left unchanged.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.