WP List Tables

Last Updated: August 22, 2021

How to add a new column to List Table

You can use the following filter to WordPress List Table.

apply_filters( "manage_{$screen->id}_columns", string[] $columns )
 public function build_list_table($screen_id)
        add_filter('manage_edit-' . $screen_id . '_columns', array($this, 'add_columns'));

    public function add_columns($columns)
        return array_merge($columns, $this->columns);

Another method

You can use the following method

apply_filters( "manage_{$post_type}_posts_columns", string[] $post_columns )
function my_custom_columns_list($columns) {
    unset( $columns['title']  );
    unset( $columns['author'] );
    unset( $columns['date']   );
    $columns['product_number']     = 'Product Number';
    $columns['custom_handler']     = 'Nice name';
    return $columns;
add_filter( 'manage_product_posts_columns', 'my_custom_columns_list' );

How to change the cell value

You can use the

add_action( 'manage_'.$post_type.'_posts_custom_column' ,array($this,'custom_column_values'), 10, 2 );

Change the name of the column

// chage the column name of the order table
function wpse152971_replace_column_title_method_b( $posts_columns ) {
    $posts_columns[ 'title' ] = 'new title';
    return $posts_columns;