wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Add post ID to posts, pages admin columns

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add ID to post and pages admin columns.

snippet :  PHPcopy
    add_filter('manage_posts_columns', 'posts_columns_id', 5);
    add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2);
    add_filter('manage_pages_columns', 'posts_columns_id', 5);
    add_action('manage_pages_custom_column', 'posts_custom_id_columns', 5, 2);
function posts_columns_id($defaults){
    $defaults['wps_post_id'] = __('ID');
    return $defaults;
}
function posts_custom_id_columns($column_name, $id){
	if($column_name === 'wps_post_id'){
        	echo $id;
    }
}

Did you like this post? If so please share it with your friends. Thanks!

jqsnipp.com | we just launched jquery snippets website