Add custom columns in custom post type browse page

Here is an sample of my plugin’s code where I set a custom post type “aei_team_member” and add 2 columns (Prénom and Photo where Photo is a thumbnail) in admin list using :

manage_${post_type}_posts_columns

and

manage_{$post_type}_posts_custom_column

Further information can be found here: https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column

I hope it helped!

/**
 * Adds a thumbnail column in the admin panel.
 */
function add_aei_team_member_columns($columns) {
  $new = array();
  foreach($columns as $key => $title) {
    if( $key == 'taxonomy-aei_team_member_group' )
      $new['firstname'] = 'Prénom';
    if( $key == 'date' )
      $new['thumbnail'] = 'Photo';
    $new[$key] = $title;
  }
  return $new;
}

add_filter('manage_aei_team_member_posts_columns' , 'add_aei_team_member_columns');

/**
 * Adds a thumbnail column in the aei_team_member list in admin panel.
 */
function thumbnail_custom_columns($column_name, $id) {
  switch( $column_name ) {
    case 'thumbnail':
      if( has_post_thumbnail() ) {
        the_post_thumbnail( array( 80, 80 ) );
      } else { ?>
        <?php $upload_dir = wp_upload_dir(); ?>
        <?php $upload_dir = $upload_dir['baseurl']; ?>
        <img src="https://wordpress.stackexchange.com/questions/226422/<?php echo get_stylesheet_directory_uri(); ?>/img/default-avatar.png" height="80" width="80" />
      <?php }
      break;
    case 'firstname':
      echo get_post_meta( $id, 'member_firstname', true );
      break;
  }
}

add_action('manage_aei_team_member_posts_custom_column', 'thumbnail_custom_columns', 10, 2);

It gives me this:

new columns

To delete a column, just use unset() within this function :

function my_columns_filter( $columns ) {
   unset($columns['author']);
   unset($columns['categories']);
   unset($columns['tags']);
   unset($columns['comments']);
   return $columns;
}

// Filter pages
add_filter( 'manage_edit-page_columns', 'my_columns_filter',10, 1 );    

// Filter Posts
add_filter( 'manage_edit-post_columns', 'my_columns_filter',10, 1 );

// Custom Post Type
add_filter( 'manage_edit-CUSTOMPOSTTYPE_columns', 'my_columns_filter',10, 1 );

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş