Learn how to get post and page IDs in WordPress with this comprehensive guide. There can be many occasions when you need to access the page or post IDs. However, the reason behind could be anything from trying to apply some special CSS for some particular page to changing elements on a single page or many. For whatever reason you wish to get post and page IDs in WordPress, the process is simple. And in this guide, I will show you how to do it effortlessly. So, let’s get started! 

When you create a website, you create different pages that represent different forms of information for your users as well as visitors. WordPress is the most popular choice for designing beautiful and fully-functional websites in no time. It has a simple-to-use interface and thousands of WordPress plugins to choose from. But make sure you know how many WordPress plugins a website should have. Never bloat your website with unnecessary plugins. However, the simple and easy to navigate your website is, the more you will be able to drive traffic to your website. You need to be very sure about every style or every action you perform on your website. 

Everything you have on your WordPress page includes a unique identification number. It includes pages, posts, media, tags, and comments. Since there are several posts, pages, comments, and media files. It gets difficult to find the specific ID that you need to access. Of course, all IDs are not visible by default, you will have to look for them externally. However, it is not rocket science. The only requirement is that you should know where to look. So, let’s dig a little deeper and see how easily you can get post and page IDs in WordPress. 

Let’s get rolling!

What are Post and Page IDs in WordPress 

WordPress is known for its simplicity and its ability to scale as and when required. That’s why it is one of the most widely used content management systems out there. You know there are numerous benefits of using a content management system. Thus, no matter which type of website you are creating, be it a personal website or a business website. WordPress is the best fit for every type of website. Moreover, it is equally important to know that every website builder that you choose to build a website with support WordPress. 

Every piece of content on the WordPress website has a unique ID. Each page and post on your WordPress website have a unique identification number known as page ID and post ID respectively. These IDs are required for the website to function well. All of your WordPress themes, widgets, and plugins use these IDs to find a particular part of your website. I assume you know the post vs page differences and you know how you can use them to build your brand effectively. 

These post and page IDs are not helpful in theme and plugin functioning only. But it also helps you perform advanced tasks and focusing on some specific sections of your WordPress website. You can easily find these post and page IDs in WordPress either with the help of a plugin or using some other methods. Let’s now go through the methods to get post and page IDs in WordPress. 

Methods to get Post and Page IDs in WordPress

There are various methods to get post and page ID in WordPress, you can use any method that you find easy. However, all the discussed methods are pretty simple and anyone with some basic knowledge can use them and get post and page IDs without a hitch. 

Method 1: Get Post and Page IDs in WordPress Manually 

By manually does not mean that you have to be technically skilled. Just follow the instructions given and you will be able to get the post and page IDs without any difficulty. However, the ID is clearly visible in the URL of any post or page when you edit any content on your WordPress dashboard. 

The very first thing is to log in to your WordPress dashboard and go to the desired post or page depending on your choice. Posts → All Posts 

Get Post and Page IDs in WordPress

You shall see all the posts now. Hover over the post you wish to obtain the ID of. After you hover over the title of the post you are targeting, you are now required to click on the Edit and a new page will then open. 

Get Post and Page IDs in WordPress Edit

Now click on the URL and look for the part that includes ‘post=’. Whatever number comes after the equal to sign is the ID number that you need. 

Post and Page IDs in WordPress

Voila! You have the ID you need. You can use it however you like. 

Find Media, Category, and Tag IDs in WordPress 

Apart from the post and page IDs in WordPress, there are other IDs too, such as tags, categories, and media. These tags help you optimize your website. These IDs can be helpful for you if you want to fine-tune certain pieces of media i.e. images or videos. It is advisable to use SEO friendly images for WordPress. Whereas, using categories and tags allow you to configure a large group of particular posts. 

First, click on the Post → Categories 

Hover the mouse over your picked names in the list of categories. The URL address will be shown in the lower right corner. However, the category ID will appear between ‘tag_ID and &post’. 

Now, on the edit page, visit the URL bar, you shall see the ID here. 

Method 2: Get Post and Page ID Using a Plugin

Show IDs by 99 Robots

Yes, you can make use of a WordPress plugin to get post and page IDs in WordPress. There are several plugins available to use. But I will show you the process to do it with help of the Show IDs by 99 Robots WordPress plugin. Of course, using a plugin makes it million times easier to find post and page IDs as compared to doing it manually. 

This is one of the most commonly used WordPress plugins. With over twenty thousand active installs, it is gaining more popularity with every passing day. It is pretty simple and a lightweight plugin to display post ID, page ID, links ID, categories ID, tags ID, media ID, comments ID, link categories ID, and much more. You can quickly download it from the WordPress repository, it’s totally free to use. 

All you need to do is install the WordPress plugin and then activate the plugin. Thereafter you shall see a new ID column in your WordPress dashboard. You will now see the ID column in each ‘Edit’ interface by default. 

You shall be seeing the IDs for:

  • Posts 
  • Pages 
  • Media library items 
  • Tags 
  • Categories 
  • Custom post types 
  • Links 
  • Comments 

However, if you wish to hide the column for some definite type of content, then you make use of the built-in Screen Option given at the right top corner. 

In order to do that, click on the Screen Options   

screenoption

Now, uncheck the ID box here.

Id

That’s it! You are done hiding the options. 

Method 3: Use PHP to Get the Post and Page ID in WordPress 

You can also get the post and page ID by tweaking the code of your WordPress website. I would suggest, if you are not so sure about your coding skills, then you can skip this method and should go for the plugin method. However, if you are comfortable with the coding section, then you can go ahead without thinking much. 

For instance, you can use the ‘get_the_id();’ function and return the ID of the post where it is executed. 

Method 4: Find it From WordPress Database

WordPress database stores each and every information of your WordPress website. This includes IDs for every post and page that you are seeking and all other related information that you would ever need. I believe you know your WordPress database name because it will make it easy for you to fetch information from the database. 

There are many WordPress hosting providers that let you access your website’s database via a custom interface. You need to go to phpMyAdmin. Now open your website’s database and navigate to the wp_posts table. You shall now see each post’s ID under the ID column to the left of post_author. Whichever ID you need, you can copy from here and use it however you like. 

So, this is how you can get post and page IDs in WordPress. You can choose any method that you find easy and straightforward. 

Happy Web Development! 

How to Get Post and Page IDs in WordPress – In Conclusion 

So, this is it! Now you know how to get post and page IDs in WordPress. However, there can be times when you don’t need to access the post and page IDs, and if you are a beginner you will surely not get involved in such activity, thinking that you might end up damaging something. But if you follow this guide, the methods discussed-above are really simple to perform and all you have to do is follow the mentioned steps. In fact, WordPress is pretty simple and you can use it to make any kind of website you wish. 

Right from the start to other things such as optimizing your WordPress website to minimize the load time, improve performance of your website, using the essential plugins for WordPress website, etc. Everything is so easy to carry out. However, when you know how to customize the WordPress dashboard and other related customization options. It always benefits you. And with this guide, you are now able to get post and page IDs in WordPress without a hitch. If you still have any doubts or queries regarding fetching IDs, feel free to leave me a message below in the comments section, I will get back to you as soon as possible.