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

WordPress provides useful action and filter hooks to add custom column to any post types table. These hooks can be used to show either taxonomy or post meta in additional custom column. In this post we are going to learn how to customize post table columns in WordPress and show additional column in 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 featured image in 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 the slug of post type you want add these columns for.
add_filter('manage_{$post_type}_posts_columns', string[] $post_columns);- $post_columns: (array) - Associative array of columns 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 current post.
Add Column to WordPress Posts Table
We will create property-columns.php file and include it in functions.php theme file. We are also going to add some inline styles for this page only which can be adjusted admin side included stylesheets. Steps to add column to WP posts table:
- Register a filter hook
manage_{$post_type}_posts_columnsfor column heading. - Add two columns to
$columnsarray. - Sort columns array to change position of columns in table.
- Register an action hook
manage_{$post_type}_posts_custom_columnto show the content of each column. - Add a switch statement to check 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 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 custom column to posts table without using a plugin. This code shows the featured image of post and a custom post meta value in table column. It can also be used in queries in template files.