CP_Customization::add_id_init()
Add ID column to Post / Page Tables
Source
File: wp-includes/classicpress/class-cp-customization.php
public function add_id_init() {
$screen = get_current_screen();
if ( isset( $screen->post_type ) ) {
$type = $screen->post_type;
} elseif ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] === 'inline-save' && isset( $_REQUEST['post_type'] ) ) {
$type = $_REQUEST['post_type'];
} else {
return;
}
if ( ! in_array( $type, array( 'post', 'page' ), true ) ) {
return;
}
add_filter( "manage_edit-{$type}_columns", array( $this, 'add_id_column' ) );
add_action( 'admin_head', array( $this, 'add_id_style' ) );
add_action( "manage_{$type}_posts_custom_column", array( $this, 'add_id_data_cb' ), 10, 2 );
add_filter( "manage_edit-{$type}_sortable_columns", array( $this, 'add_id_data_sortable' ) );
}