avatar

Andres Jaimes

Add a Thumbnail to Admin Post Columns in WordPress

By Andres Jaimes

Here is a snippet to add 64×64 images to the Admin Post Columns in WordPress. Having thumbnails may result extremely helpful, specially if you have hundreds of posts.

Thumbnails wordpress

You have to copy and paste the following code into the functions.php file of your theme.

function posts_columns($defaults){
    $defaults['the_post_thumbs'] = __('Thumbs');
    return $defaults;
}

function posts_custom_columns($column_name, $id){
        if($column_name === 'the_post_thumbs'){
        echo the_post_thumbnail( array(64, 64) );
    }
}

add_filter('manage_posts_columns', 'posts_columns');
add_action('manage_posts_custom_column', 'posts_custom_columns', 10, 2);

 

Instead of array(64, 64) you can also use default image sizes like ‘featured_thumbnail’, ‘thumbnail’, ‘medium’, ‘large’ and ‘full’.

You can find more information on these functions here: