
Easily see whether a post has a featured image set.
Similar to my recent Add Shipping Classes column to Products admin page post, the code here adds a column to the Posts admin page, showing whether the post has a Featured image set. This can serve as a quick reminder whether you need to add one to a post.
The basic process
As before, adding a column is a two step process: use a filter to add the column key and title, and an action to echo the column data.
In the code below I added the new column after the Tags column. The code is set up to make it easy to change where the new column is added (enhancement idea: add apply_filters() call to make it easy to override without changing the code). If a column is not specified then the new column is added to the end.
Featured image or not?
The simple has_post_thumbnail() returns whether the post has a featured image set.
I chose to keep the column information simple, using a tick mark instead of ‘Yes‘ and a dash instead of ‘No‘ (the latter matches the Tags and Comments column info, including the screenreader markup).
Turning off columns and column width
Again the new column (and existing columns) can be hidden via the pull down Screen Options panel. I also stuck with 15% column width.
Leave a Reply