How To Find Your WordPress Page And Post IDs
In this tutorial, you will learn how to easily find your WordPress Page and Post IDs and why knowing this information is useful.
The following tutorials will help you gain a better understanding of the topic covered in this tutorial:
- WordPress Posts vs WordPress Pages Explained
- How To Create A Post In WordPress – Part 1
- How To Create A Post In WordPress – Part 2
- How To Create Pages In WordPress
- How To Use The WordPress Screen Options Tab
Why Is Knowing Page IDs/Post IDs Useful?
Knowing how to find the unique ID of a post or page can be quite useful if, for example, you want to filter out or exclude certain pages from displaying on sections of your site like your sitemap, or conversely, if you want to display only selected posts or pages on lists, tables, sidebar widgets (e.g. the Pages widget), etc.
How To Locate The ID Of Any Post Or Page In WordPress
To locate the ID of a post or page, log into your WordPress admin area and either go to the Pages or the Posts screen, depending on which type of ID you are searching for.
For this example, let’s say we are looking for the ID of a specific page, so we need to go to the Pages screen. From the main menu, select Pages > All Pages.
This brings you to the Pages screen.
Locate the page (or post) that you are searching for (and want to know the ID of), and hover over the title.
The unique ID value of the page (or post) will be displayed in the status bar of your web browser. In our example, the page ID is 171.
You can also view your Page or Post ID in the URL field (i.e. the web address bar) at the top of your web browser when editing a post or page.
If you plan to use this ID for a specific purpose (e.g. to exclude this page from showing on a list or site map), make a note or write down this ID number.
WordPress Post & Page ID – Practical Uses
Let’s go through some of the practical applications of knowing how to find the unique ID of your posts or pages:
Exclude Posts Or Pages Displaying On Your Visitor’s Site Map
You may have created some pages (or posts) on your site that you don’t want your visitors to know about or to easily find when looking at your site map. For example, an unprotected download or thank you page or a page containing a special offer for a selected group of users.
Many site map plugins include a section that lets you exclude pages, posts, or categories from displaying to visitors by simply entering their IDs into a field.
Exclude Pages From Displaying On Your Sidebar
Another useful application for unique Page IDs is to prevent these from displaying in the Pages Widget on the sidebar area of your site.
Just type in, paste, or enter all of the Page IDs you want to exclude separated by commas into the Exclude field of the Pages widget and click the Save button to update your settings.
Display Selected Posts or Pages Only
Conversely, you may only want selected posts or pages to appear on a list (for example, a list of featured posts, pages, or products).
For example, here is a screenshot of a WordPress plugin called Content Views that lets you create custom lists by including only selected posts and pages using different filters, such as their unique IDs.
Exclude Posts Or Pages From Your XML Sitemap
Like site maps for visitors, some SEO plugins let you exclude posts or pages from your site that you don’t want search engines to easily find from your XML sitemap by entering their IDs into an ‘Exclusion’ field.
Quickly Find Posts, Pages, Or Custom Post Types By Replacing IDs On your Browser
Here’s something very handy to know about the way WordPress uses unique IDs for almost everything:
You can load any post, page, or custom post type on your web browser by replacing the ID value of another item’s URL and refreshing your browser.
Let’s show you what this means and how useful this can be if a situation like the example shown below should ever arise.
Here is a post containing a shortcode used to display a list. This shortcode, however, includes only the unique ID of the list item (‘188013’). Let’s say that we need to edit the items included in this list. How can we find out which list this post is using?
Let’s see why this is a problem…
First, let’s copy the list item number to our clipboard and paste it into a plain text file as we’ll be using this ID in a moment.
The site in this example uses a custom post type called “Lists,” which is not a default feature of WordPress (i.e. someone created this feature for the site owners.)
If we go to the Lists screen on this site, we can see that they have created over 650 list entries. We need to edit list number ‘188013.’
Which of these lists is number ‘188013’?
Fortunately, you don’t have to hover over the title of every item on this screen until you find list item number ‘188013’. There is a much easier simpler, easier, and faster way.
Here’s how to easily find the list we’re looking for:
Just click the Edit link of any item on the screen…
This will load the item into your web browser. Note the item’s ID number is included in its URL. In this case, the ID of this list item is 152076…
All you have to do is replace the ID in this URL with the ID that you’ve previously copied to your clipboard and hit the Enter key to refresh your browser.
The item you were searching for will then be loaded on your screen and you can now view, edit, or work on it.
WordPress Plugins – Page/Post} IDs
If you work with Page or Post IDs on a regular basis, it’s a good idea to install a plugin that will give you quick access to these IDs.
If you search for terms like “reveal ID,” “show post ID,” etc. in the Add Plugins screen (Plugins > Add Plugins), you will find a number of plugins that can perform this function:
Here are just some of the plugins you can use:
Most of these plugins perform a similar function — they add a column to your table of Posts and Pages displaying the item’s ID.
Let’s go through some of these plugins so you can see exactly what they do.
This free plugin displays the IDs for posts, pages, categories, tags, media, users, comments, links, link categories, custom taxonomies, and custom post types. It also adds a sortable column header to your table of Posts and Pages.
You can view all the plugin’s settings by going to Settings > Reveal IDs.
For more information about this plugin, go here: Reveal IDs
99 Robots Show IDs is another useful plugin that displays your posts, pages, media, links, categories, tags, and users in the Posts and Pages admin tables. It’s also very lightweight and supports custom post types and taxonomies.
For more information about this plugin, go here: 99 Robots Show IDs
ID Arrays adds a column of IDs to your Table of Posts and Pages and provides a useful function that lets you copy a list of selected Post and Page IDs to your clipboard.
This is useful if you are working with a long list of posts or pages where noting down each ID separately would be very time-consuming.
For more information about this plugin, go here: ID Arrays
If you have installed a plugin to display your page or post IDs and cannot see the ID column in the Post or Page screens, open the Screen Options tab and make sure that the ID column checkbox is selected.
Congratulations! Now you know how to easily find post and page IDs in WordPress.
"I love the way your email series "Infinite Web Content Creation Training Series" is documented and presented. It is very absorbing and captivating. The links and tutorials are interesting and educational. This has motivated me to rewrite my content following the concepts I am learning from the email series." - Mani Raju, www.fortuneinewaste.com
We are not affiliated, associated, sponsored, or endorsed by WordPress or its parent company Automattic. This site contains affiliate links to products. We may receive a commission for purchases made through these links.