I have a client site which accepts images from users as posts. For moderation, we are opening each draft post which obviously takes a lot of time if a hefty amount of images are moderated.

So, Is there a way to show featured images of the post on the admin post list page as a column?

4 s
4

This is what I’m using, cobbled together from snippets found online… It’s uses a filter on manage_posts_colummns to re-jig the headers and an action on manage_posts_custom_column to add the row level data.

function custom_columns( $columns ) {
    $columns = array(
        'cb' => '<input type="checkbox" />',
        'featured_image' => 'Image',
        'title' => 'Title',
        'comments' => '<span class="vers"><div title="Comments" class="comment-grey-bubble"></div></span>',
        'date' => 'Date'
     );
    return $columns;
}
add_filter('manage_posts_columns' , 'custom_columns');

function custom_columns_data( $column, $post_id ) {
    switch ( $column ) {
    case 'featured_image':
        the_post_thumbnail( 'thumbnail' );
        break;
    }
}
add_action( 'manage_posts_custom_column' , 'custom_columns_data', 10, 2 ); 

You can also use this on custom post types by filtering on manage_CPTNAME_posts_columns.

Leave a Reply

Your email address will not be published. Required fields are marked *