How to add a ID column into wordpress Posts and pages
Add these below code to functions.php file and after adding visit
../wp-admin/edit.php?post_type=page
and ../wp-admin/edit.php
/* Add Post ID column */
add_filter('manage_posts_columns', 'posts_columns_id', 5);
function posts_columns_id($defaults){
$defaults['wps_post_id'] = 'ID';
return $defaults;
}
add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2);
function posts_custom_id_columns($column_name, $id){
if($column_name === 'wps_post_id'){
echo $id;
}
}
add_action('admin_head', 'id_column_style');
function id_column_style() {
echo '';
}
/* Add Page ID column */
add_filter('manage_pages_columns', 'pages_columns_id', 5);
function pages_columns_id($defaults){
$defaults['wps_page_id'] = 'ID';
return $defaults;
}
add_action('manage_pages_custom_column', 'pages_custom_id_columns', 5, 2);
function pages_custom_id_columns($column_name, $id){
if($column_name === 'wps_page_id'){
echo $id;
}
}
add_action('admin_head', 'id_column_style');
function ids_column_style() {
echo '';
}
../wp-admin/edit.php?post_type=page
and ../wp-admin/edit.php
/* Add Post ID column */
add_filter('manage_posts_columns', 'posts_columns_id', 5);
function posts_columns_id($defaults){
$defaults['wps_post_id'] = 'ID';
return $defaults;
}
add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2);
function posts_custom_id_columns($column_name, $id){
if($column_name === 'wps_post_id'){
echo $id;
}
}
add_action('admin_head', 'id_column_style');
function id_column_style() {
echo '';
}
/* Add Page ID column */
add_filter('manage_pages_columns', 'pages_columns_id', 5);
function pages_columns_id($defaults){
$defaults['wps_page_id'] = 'ID';
return $defaults;
}
add_action('manage_pages_custom_column', 'pages_custom_id_columns', 5, 2);
function pages_custom_id_columns($column_name, $id){
if($column_name === 'wps_page_id'){
echo $id;
}
}
add_action('admin_head', 'id_column_style');
function ids_column_style() {
echo '';
}