How to add Post and Page ID column to WordPress Admin

Age of Article Warning:
This article was originally published 79 months ago. The information, tips and techniques explained may outdated. Examples shown on this page may no longer work. Please consider this when viewing the below content.

WordPress pages and posts all have a unique post ID.

This ID allows us to individually change the CSS styling of a particular post or page. It also is useful when working with certain WordPress plugins such as SEO and sitemaps.

So we may want to find out the ID and the easiest way is simply to hover over the post name when looking at the list of posts in the admin section. But another way to have this information readily available is to show the IDs as a new custom column.


To add this new column, simply add these lines of code to your childtheme’ss functions.php file:

add_filter(‘manage_posts_columns’, ‘posts_columns_postpageID’, 5);
add_action(‘manage_posts_custom_column’, ‘posts_custom_columns_postpageID’, 5, 2);
add_filter(‘manage_pages_columns’, ‘posts_columns_postpageID’, 5);
add_action(‘manage_pages_custom_column’, ‘posts_custom_columns_postpageID’, 5, 2);
function posts_columns_postpageID($defaults){
$defaults[‘wps_post_id’] = __(‘post_page_ID’);
return $defaults; }
function posts_custom_columns_postpageID($column_name, $id){
if($column_name === ‘wps_post_id’){
echo $id; }


4 thoughts on “How to add Post and Page ID column to WordPress Admin”

  1. Perfect! I just imported 152 pages to my site and hovering over links for the PageID was getting quite old. I almost added another cumbersome plugin to my wordpress arsenal when I stumbled across your very quick and easy to implement solution. Thank you David. Kudos and good day, sir.

    • Hi Richard,
      Fantastic, glad to have helped and love saving time whenever and wherever possible.
      Have a great day to you too

Comments are closed.