Show the ID Column in Admin Lists
Adds an ID column to the posts, pages and custom post type list tables so you can find IDs without hovering over links.
Opens WPIDE on
Code
add_action( 'admin_init', function () {
foreach ( get_post_types( array( 'show_ui' => true ) ) as $post_type ) {
add_filter( "manage_{$post_type}_posts_columns", function ( $columns ) {
$columns['wpide_id'] = 'ID';
return $columns;
} );
add_action( "manage_{$post_type}_posts_custom_column", function ( $column, $post_id ) {
if ( 'wpide_id' === $column ) {
echo (int) $post_id;
}
}, 10, 2 );
}
} );
add_action( 'admin_head', function () {
echo '<style>.fixed .column-wpide_id{width:64px;}</style>';
} );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.