Skip to content

Instantly share code, notes, and snippets.

@ofernandolopes
Created January 8, 2026 00:57
Show Gist options
  • Select an option

  • Save ofernandolopes/35bf6f787b907ad26d5d85586ece970c to your computer and use it in GitHub Desktop.

Select an option

Save ofernandolopes/35bf6f787b907ad26d5d85586ece970c to your computer and use it in GitHub Desktop.
Add the featured image column in admin columns
// Add the featured image column
function rudr_featured_image_column( $cols ) {
$cols = array_slice( $cols, 0, 1, true ) + array( 'featured_image' => 'Image' ) + array_slice( $cols, 1, NULL, true );
return $cols;
}
add_filter( 'manage_posts_columns', 'rudr_featured_image_column' );
add_filter( 'manage_pages_columns', 'rudr_featured_image_column' ); // Add for pages
// Fill the column with the featured image
function rudr_render_the_column( $column_name, $post_id ) {
if ( 'featured_image' === $column_name ) {
echo get_the_post_thumbnail( $post_id, array( 60, 60 ) ); // Adjust image size here
}
}
add_action( 'manage_posts_custom_column', 'rudr_render_the_column', 10, 2 );
add_action( 'manage_pages_custom_column', 'rudr_render_the_column', 10, 2 ); // Add for pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment