How to Quickly Find Page ID in WordPress or Post ID

how to find page id in wordpressIf you want to know how to find page id in WordPress, you will be surprised after reading this post since it’s very easy to know the page ID or the post ID. Knowing the page or post ID helps you as a WordPress developer or user to accomplish several tasks that may require the input of a page ID.

What is a Page ID in WordPress?

It is important to first explain briefly to those users who don’t know what a page ID is in WordPress. Basically, when a page, post or custom post type is published in WordPress it is given the unique number that identifies it in the code and structure of WordPress.

This unique number is what is referred to as the Page ID. This page id term can often be confusing for new WordPress users since it is often used interchangeably to refer to the ID of pages, posts or custom post types.

Why Find Page ID in WordPress?

In most cases when you are implementing some specific code or shortcode on a page you may be required to add the page ID so that the changes are applied to the specific page.

Use in Conditional Statements or Code

If you are a WordPress theme developer, you may want to use a conditional function like is_page() and pass a page ID instead of the name as shown in the code below :

if( is_page(20)){

   //do something here

}elseif(is_page(10)){

//do something else here

}else{

 //do something that’s default

}

Getting the page id like in the script above (page ID 20 and 10) should not be a challenge. WordPress in its very nature easily provides you with a simple way to know the page ID for every page.

Use in Shortcodes

It is common to see WordPress shortcodes that utilize page or post IDs to interlink the pages, posts or specific content. In most cases the shortcode takes the page ID as a parameter like in the example below:

[Example-Shortcode parameter_one = “PAGE ID” ]

5 Simple Steps on How to Find Page ID in WordPress

For years, when coding and testing pages, I have used this simple trick to easily and quickly know the page ID of any page or post in WordPress. The following are the 5 simple steps you can use to know the page ID of a WordPress page.

#1) Login your dashboard – First you need to be logged in your dashboard

How to Find Page Id in WordPress

#2) All pages menu – Click on all pages menu to view all the published pages

How to Find Page Id in WordPress

#3) Select page – Choose the page that you want to know its page id example –about us, home, etc.

#4) Hover on Edit Menu – carefully hover on the edit menu and you will begin to see the line that popups at the bottom that has the path of the page and also has the page id.

How to Find Page Id in WordPress

#5) Read the Permalink at the bottom – the link that pops up at the bottom contains the page id that is a number as shown below:

How to Find Page Id in WordPress

You can use exact steps on the posts to know the Post ID since pages, posts and custom posts types all have the same structures and WordPress regards them as post objects.

How to Find Page ID in WordPress Page URL

Another way you find the page ID of the selected page is by clicking on edit the page link as shown above.

When the page opens you should check the page ID from the URL that is referenced as ‘ ?post=PAGEID’ as shown in the image below:

As you can see in these two ways you do not need to install a plugin you just need to check the page ID directly from the WordPress dashboard as you edit the page.

Using a Plugin to Find Page ID in WordPress

I think using a plugin to find the page ID is overkill, you can simply find the page ID of a post without a plugin. You do not also need to check the WordPress database for the page ID that’s not necessary for most WordPress beginners.

 


Customer Reviews

NJENGAH

Customer Reviews

Jeffrey Todd 04/07/2020

Exceptional Plugin & Service

I'm in the process of building my new website, and I had a question about changing some text within the WooCommerce plugin. I was spinning my wheels trying to figure it out. Joe reached back and worked with me - going above and beyond! - until I fully understood how to effectively change what I wanted. How can you ask for more than that? I highly recommend WooCommerce (and Joe!), the plugin and service are exceptional!
-Jeffrey Todd (MyLifeChart.com)