Technology WordPress Tips & Tricks

How to Add a Featured Image Column in Admin Dashboard

Seeing featured images right in your admin list saves a surprising amount of clicking around. Here is how to add a featured image column to the admin dashboard, so managing content gets a little faster every day.

Vivek Mengu Vivek Mengu 2 min read

add-column-wp-admin-panelI’m been working extensively on WordPress related development recently and have come across very interesting customization that you can incorporate into your WordPress system. I soon realised that i was unknowingly developing an interesting repository of techniques which can be used by others too. So, I decided to start writing about these tips and tricks to make it available to other fellow developers like myself.

Today, in this post I’m going to explain to you how to add a featured image column in admin dashboard. So, where exactly will this image be displayed to the users? Well, in the admin dashboard the users will be able to see the featured image on the all posts page. An extra column will be added to the table displaying the list of all posts on the website blog.

It will look something as below!

featured-image-column-list

Step 1: In order to make the featured image visible in the admin dashboard the first thing to do would be to set the featured image a blog post. The feature image can be added from the post page in the admin dashboard.

featured-image-column-post

Step 2: Now the user will have make changes to the functions.php file in order to make the featured image visible in the default listing of posts in the admin dashboard. The manage_posts_columns filter provided by WordPress will be used to achieve this result. This filter allows you to add columns to the list pages in the admin dashboard.

add_filter('manage_posts_columns', 'posts_columns');

Step 3: Along with this you will have to use the manage_posts_custom_column hook to name the column that is being added to the default post list in dashboard and to specify the size of the featured image thumbnail that will be displayed in the admin dashboard.

add_action('manage_posts_custom_column', 'posts_custom_columns');
    function posts_columns($defaults){
    $defaults['wdm_post_thumbs'] = __('Featured Image'); //name of the column
    return $defaults;
}
function posts_custom_columns($column_name, $id){
        if($column_name === 'wdm_post_thumbs'){
        echo the_post_thumbnail(array(100,100)); //size of the thumbnail 
    }
}

However the one thing to note here would be that if the theme is updated then the code that has just been added will be overridden.

Get a FREE Consultation

Let's build something that lasts.

Share what's on your mind — a clear brief, a half-formed idea, or just a sense that something needs to change. We'll listen first, ask the right questions, and point you toward what's actually worth building.

We take on a handful of projects each quarter,ones where we can truly make a difference.

  • Receive a human response within 24 hours
  • Get a detailed scope and quote upfront
  • We're happy to sign an NDA upon request

    Free 30-Min Strategy Call

    Your Name *

    Your Phone No *

    Work Email *

    Your Budget*

    Project Details *