R
R
Ruslan Makarov2016-02-17 15:00:42
WordPress
Ruslan Makarov, 2016-02-17 15:00:42

How to add a column with post IDs in a WordPress list?

Good!
As in the admin panel, add a column with the post ID to the list of posts
Thanks in advance!
c94694447edc4ef2b2ddc4a919357b49.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2016-02-17
@facepook

add_filter('manage_posts_columns', 'my_posts_columns_id', 5);
add_action('manage_posts_custom_column', 'my_posts_custom_id_columns', 5, 2);


function my_posts_columns_id($columns){
  $columns['my_post_id'] = __('ID');
  return $columns;
}
function my_posts_custom_id_columns($column_name, $id){
  if($column_name === 'my_post_id'){
    echo $id;
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question