The next version of Index is here! To celebrate, take 25% off your purchase with the code 25OFF. Learn more
Index Logo

Add custom columns to your WordPress admin tables

Looking to customize your WordPress admin tables with additional content? We'll cover how to do it natively in code and with a codeless option.

The WordPress Way

If you’re comfortable getting into code, WordPress provides a filter to add columns to any of your post type tables. Here is how it’s formatted:

add_filter('manage_{$post_type}_posts_columns', function($columns) { 
   $columns['new_column'] = 'Column Name';
   return $columns;
}, 10, 1);

The {$post_type} value should be replaced with whatever post type’s table you want to edit (post, page, etc). The function you pass in provides a $columns array that you can add keyed values to. In our case, we have added a new column with the key of new_column and title of Column Name

Outputting content

To actually output content in your column for each post row, you need to use another filter that loops over each column and row, so you can display unique data for each post. Let’s say you want to output a meta field for your new field:

add_filter('manage_{$post_type}_posts_custom_column, function($column, $id) {
    if($column == 'new_column') {
        echo get_post_meta($id, 'meta_key', true);
}, 10, 2);

Once again, the {$post_type} value should be replaced with your post type name. This filter’s function passes both the column key and post object id. Since the filter loops over each column, we want to make sure to check if the current column matches our key and if so, echo our meta value (meta_key would be replaced by whatever meta key you want to display).

Removing columns

To remove an existing column, you can do that easily using the first filter example:

add_filter('manage_{$post_type}_posts_columns', function($columns) { 
   return $columns;
}, 10, 1);

Just pass in the column name you want to remove using PHP’s unset function. As far as grabbing the key names for each existing column, you can inspect the table in your web browser to see them (they are the id on each table heading):

The no-code way

If coding multiple column values to customize your post list tables sounds tedious, you can use the Index plugin to toggle any standard column, taxonomy, or meta value. Here’s how:

  1. Download and activate the Index plugin
  2. Go to Settings > Index
  3. Select the post type you want to customize
  4. Toggle any column in the list, or edit the name
  5. For meta fields: select an optional format to display your values as prices, dates, images, and HTML

Get started with Index

See for yourself why Index is the most intuitive, beautiful interface for managing your WordPress content.