Check out PHP code snippet which allows
you to add ID column to page and post listing pages on the WordPress
dashboard.
//Add post ID to posts, pages admin
columns
add_filter('manage_posts_columns' ,
'custom_set_posts_columns', 5);
add_filter('manage_pages_columns' ,
'custom_set_posts_columns', 5);
function
custom_set_posts_columns($columns) {
$columns['post_id'] = __('ID');
return $columns;
}
add_action(
'manage_posts_custom_column' , 'custom_set_posts_columns_value', 10,
2 );
add_action(
'manage_pages_custom_column' , 'custom_set_posts_columns_value', 5,
2);
function
custom_set_posts_columns_value( $column, $post_id ) {
if ($column == 'post_id'){
echo $post_id;
}
}
add_action('admin_head','custom_admin_styling');
function custom_admin_styling() {
echo '<style type="text/css">';
echo 'th#post_id{width:50px;}';
echo '</style>';
}
0 comments:
Post a Comment