Age of Article Warning:
This article was originally published 48 months ago. The tips and techniques explained may be outdated, or information may longer be applicable. 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.

post-ids

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

[php]
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; }

}
[/php]

How to add Post and Page ID column to WordPress Admin was last modified: February 12th, 2013 by David Tiong
How to add Post and Page ID column to WordPress Admin