Add Post Featured Thumbnail To Post List on WordPress
Adding a featured image for each post is important for your website’s beauty & very much for the SEO part.
To make sure all posts have a featured image, use this code to add a thumbnail of the image to the post list in your wp-admin:
function add_thumbnail_to_post_list_data($column,$post_id) { switch ($column) { case 'post_thumbnail': echo '<a href="' . get_edit_post_link() . '">'.the_post_thumbnail( 'thumbnail' ).'</a>'; break; } } function add_thumbnail_to_post_list( $columns ) { $columns['post_thumbnail'] = 'Thumbnail'; return $columns; } if (function_exists('add_theme_support')) { // Add To Posts add_filter( 'manage_posts_columns' , 'add_thumbnail_to_post_list' ); add_action( 'manage_posts_custom_column' , 'add_thumbnail_to_post_list_data', 10, 2 ); // Add To Pages add_filter( 'manage_pages_columns' , 'add_thumbnail_to_post_list' ); add_action( 'manage_pages_custom_column' , 'add_thumbnail_to_post_list_data', 10, 2 ); }
One thought on “Add Post Featured Thumbnail To Post List on WordPress”