← Back to All Snippets

Add Featured Image Thumbnail Column to WP Admin Post List

⚡ Target: functions.php 🔒 Tested: WP 6.6+ / PHP 8.2+ 💻 Lang: PHP
PHP (functions.php)
// 1. Add Thumbnail Column Header
add_filter( 'manage_posts_columns', function( $columns ) {
    $new_cols = [];
    foreach ( $columns as $key => $title ) {
        if ( 'title' === $key ) {
            $new_cols['tipwp_thumb'] = __( 'Image', 'tipwp' );
        }
        $new_cols[$key] = $title;
    }
    return $new_cols;
} );

// 2. Render Thumbnail in Column
add_action( 'manage_posts_custom_column', function( $column, $post_id ) {
    if ( 'tipwp_thumb' === $column ) {
        if ( has_post_thumbnail( $post_id ) ) {
            echo get_the_post_thumbnail( $post_id, [ 48, 48 ], [ 'style' => 'border-radius: 4px; object-fit: cover;' ] );
        } else {
            echo '<span style="color:#a1a1aa;font-size:11px;">No Image</span>';
        }
    }
}, 10, 2 );

Adds a clean preview thumbnail column to the admin post list (wp-admin/edit.php) so editors can visually verify featured images.

← Back to All Snippets Explore Dev Tools →