WordPress Logo

Change the “Featured Image” title in WordPress

Sometimes we need to rename the WordPress “Featured Image” meta box title; And give it a custom name.

Let’s imagine you want to display the companies that you’ve worked with on your website. You created a custom post type to save the companies details. There is a little meta box on the sidebar that allows you upload a logo for each entry. The only ugly thing is its title, “Featured Image”, and we want to change it to “Company Logo”.

1. Your own custom post types

If you’ve created the custom post type yourself, it’s just a matter of adding the highlighted labels to the labels array when you define a custom post type.



2. Posts, pages, or those you haven’t created

But for default post types (post, page) or those you don’t have control over, it needs more steps to rename it completely.

First, we change the meta box title using “do_meta_boxes” action in order to remove the default “featured image” meta box, and replace it with a new title. Using this action we re-declare the meta box with a new title.

The above action only updates the meta box title. We still need to rename “set featured image”,  “remove featured image” link, and the opening window’s title/button labels.

WordPress currently doesn’t have a specific filter for changing the “set” and “remove” link, but fortunately, the meta box’s HTML markup is available through the filter “admin_post_thumbnail_html”. So all we need to do is to replace the link titles with the new ones with PHP’s built-in str_replace function.

There is still one step to do. It doesn’t address the ones displayed in the opening window when you click on “set featured image”.

Here’s the last step, we can use “media_view_strings” filter.

The filter allows us to change the strings of the media view.