How to add a Featured Image Column inside the Admin Post List (Video)
In this video, I will show you how you can show a featured image Column inside the Wordpress Admin Post List.
Code used in this video:
add_filter( 'manage_posts_columns', function ( $columns ) {
// You can change this to any other position by changing 'title' to the name of the column you want to put it after.
$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_action( 'manage_posts_custom_column', function ( $column ) {
if ( 'featured_image' === $column ) {
the_post_thumbnail( array( 300, 80 ) );
}
} );
In this way, You will be able to see the featured images used on the blog post right within the admin area of your Wordpress website.
Note: You can use any code manager Plugin Like Code snippets, WP Code, etc that allows you to add PHP snippets to your website.
You should run this snippet on the admin area only as this is not needed in the front end of the website. So, it won’t impact the Speed performance of your website and you will be able to use it without any worry.
By following this video, You will be able to add a featured image column to your Wordpress Admin Post List area. If you have any doubts, you can ask me in the comment section.
Thank you.