In WordPress sites, you may have noticed that the default “Posts” page in the WordPress admin doesn’t show a thumbnail of the featured image. You only see the post title, author, categories, and dates, but no preview of the image itself.
When managing a large blog or content-heavy website, you might upload dozens of posts with different featured images. Without thumbnails in the admin list, it’s difficult to see which post is associated with which image at a glance. In this post, we’ll look at how adding a small preview of the featured image right in the admin list can make managing posts much easier.
Solution: Add a Featured Image Column to the WordPress Admin Posts List
This code adds a new ‘Featured Image’ column to the WordPress Posts admin page, placed right after the Title column, and displays the post’s featured image thumbnail in that column.
/** * Add a "Featured Image" column to the Posts screen */ function ts_feature__image_column( $columns ) { $move_after = 'title'; $move_after_key = array_search( $move_after, array_keys( $columns ), true ); $first_columns = array_slice( $columns, 0, $move_after_key + 1 ); $last_columns = array_slice( $columns, $move_after_key + 1 ); return array_merge( $first_columns, array( 'featured_image' => __( 'Featured Image' ), ), $last_columns ); } add_filter( 'manage_posts_columns', 'ts_feature__image_column' ); /** * Display the featured image in the column */ function ts_feature__image_column_content( $column ) { if ( 'featured_image' === $column ) { if ( has_post_thumbnail() ) { the_post_thumbnail( array( 300, 80 ) ); // thumbnail size } else { echo '—'; // show a dash if no image } } } add_action( 'manage_posts_custom_column', 'ts_feature__image_column_content' );
Output
As an admin, you can see a new ‘Featured Image’ column on the Posts page showing each post’s thumbnail next to its title.
