Add a Custom Column to Posts Table in WordPress
By default, WordPress shows only core columns in the post list table like Title, Author and Date. Learn how to add a custom column to the posts table in WordPress without using a plugin.

WordPress provides a possibility to add custom columns to any post type table by using their useful action and filter hooks. These hooks can be used to show either taxonomy or post meta in an additional custom column. In this post, we are going to learn how to customize post table columns in WordPress and show additional columns in the posts table without using a plugin.
We have a custom post type named "Property" which has "Property price" Custom Post Meta associated with it. We are going to display the featured image in the posts table as well as the property price meta value.
WordPress Hooks to Manage Posts Table Columns
add_filter('manage_{$post_type}_posts_columns', string[] $post_columns);
do_action('manage_{$post_type}_posts_custom_column', string $column_name, int $post_id);The "manage_{$post_type}_posts_columns" is for registering our new columns, while "manage_{$post_type}_posts_custom_column" is for showing the content of those columns, and $post_type is a slug of the post type you want to add these columns for.
add_filter('manage_{$post_type}_posts_columns', string[] $post_columns);- $post_columns: (array) - Associative array of column heading strings.
do_action('manage_{$post_type}_posts_custom_column', string $column_name, int $post_id);- $column_name: (string) - The name of the column for which we are adding the content.
- $post_id: (int) - The id of the current post.
Add Column to WordPress Posts Table
We will create the property-columns.php file and include it in the functions.php file of active theme. We are also going to add some inline styles for this page only, which can be adjusted on the admin side including stylesheets. Steps to add a column to the WP posts table:
- Register a filter hook
manage_{$post_type}_posts_columnsfor column heading. - Add two columns to the
$columnsarray. - Sort the columns array to change the position of columns in the table.
- Register an action hook
manage_{$post_type}_posts_custom_columnto show the content of each column. - Add a switch statement to check the column and add content accordingly.
property-columns.php
<?php
add_action('admin_enqueue_scripts', 'admin_scripts_and_styles');
function admin_scripts_and_styles() {
global $pagenow;
$post_type = isset($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : null;
if($pagenow === 'edit.php' && $post_type === 'property'){
wp_register_style( 'post-columns-style', false );
wp_enqueue_style( 'post-columns-style' );
$custom_css = "
.post-type-property th.column-featured_image{
width: 70px;
}
.post-type-property td.column-featured_image > img{
max-width: 100%;
height: auto;
}";
wp_add_inline_style( 'post-columns-style', $custom_css );
}
}
add_filter('manage_property_posts_columns', 'register_property_columns' );
function register_property_columns($columns)
{
$sorted_columns = [];
// Get array of column keys for sorting, You can prepare a static array of columns if columns are already knonwn
$column_keys = array_keys($columns);
// Add featured image column to second position in columns
array_splice($column_keys, 1, 0, ['featured_image']);
// Add price column to second last position in columns
array_splice($column_keys, count($column_keys) - 1, 0, ['property_price']);
// Add both columns to original columns at the end
$columns['featured_image'] = __('Image', 'text-domain');
$columns['property_price'] = __('Price', 'text-domain');
// Loop through keys and prepare new sorted array of columns
foreach($column_keys as $column_key){
$sorted_columns[$column_key] = $columns[$column_key];
}
return $sorted_columns;
}
add_action('manage_property_posts_custom_column', 'add_property_columns_content', 10, 2);
function add_property_columns_content($column, $post_id)
{
switch ($column) {
case 'featured_image':
if (has_post_thumbnail()) {
the_post_thumbnail('thumbnail', ['class' => 'attachment-thumbnail attachment-thumbnail-small']);
}
break;
case 'property_price':
echo esc_html(get_post_meta($post_id, 'property_price', true));
break;
}
}
Now we will include this property-columns.php in our functions.php to make it work.
include('property-columns.php');This is how the property posts list table will look like:

These columns will now also show in screen options like this:

We now have a working implementation of adding a custom column to the posts table without using a plugin. This code shows the featured image of the post and a custom post meta value in the table column. It can also be used in queries in template files.