functions.php

optimize seo, security and theme development
with these functions.php code snippets

How To Add Thumbnail Column To WordPress Post / Page Admin

While moderating the content, image is most important element as this is first thing visible to users. There are multiple benefits of displaying Featured Image of Post as thumbnail in All Posts page inside the WordPress admin panel.

  • It tells the admin quickly how many posts are there having an image with them.
  • It enables the admin to moderate the posts having inappropriate images right away. In this way, the admin can save time because they doesn’t need to go into each post and then have a look at attached image. The site admin can quickly pick and choose which posts need to be fixed at first hand.

How to create a PHP function for adding thumbnail column to WordPress post / page admin?

You can follow these simple steps to add function for WordPress Admin Thumbnails.

Step-1: Go to your theme’s functions.php file at this location “/wp-content/themes/yourtheme/functions.php”

Step-2: Now create the function and then add filter to hook your function with WordPress API. If you already haven’t defined any custom functions before, you can add this in the end of file.

These functions are creating a column in All Posts page of admin panel and displaying featured image as thumbnail there.

Step-3: After defining the functionality, it is time to hook this function with the specific filter actions “manage_posts_columns” and “manage_posts_custom_column” which are responsible for creating the UI in admin panel for Post/Page main landing page, All Posts and All Pages respectively.

Syntax of add_filter() function is like this.

add_filter ("tag_name_here", "function_to_add");

First variable being passed to this function defines the specific filter action to which function is hooked and second variable defines the function name that is to be added on hooked event.

Add these two lines after closing your function code.

Copy and paste the full function below: