Webtips Wordpress

Change Featured Image Text from the WordPress backend to a custom Label

techrounder-default
In brief
You can customize the default "Featured Image" label in the WordPress backend by uploading the class-featured-image-metabox-customizer.php file to your theme folder, including it in your functions.php file, and then instantiating the class with your preferred labels for the metabox title, set text, and remove text.

It will be useful to change the defaultFeatured Image” text from the WordPress backend for customizing the backend. If we are creating a new post type, we can change the text according to that post type.

Eg: If we are creating a new post type called “Gallery”, we can change the “Featured Image” text to “Gallery Image” like that.

For that follow the steps

1. Upload the file class-featured-image-metabox-cusomizer.php into your theme folder.
2. In the function.php file in the theme folder, include the above uploaded file into it.

require get_template_directory() . '/class-featured-image-metabox-cusomizer.php';

3. Add the following code into function.php file

new Featured_Image_Metabox_Customizer(array(
	'post_type'     => 'page',
	'metabox_title' => __( 'Page Image', 'feat-img-custom' ),
	'set_text'      => __( 'Set Page Image', 'feat-img-custom' ),
	'remove_text'   => __( 'Remove Page Image', 'feat-img-custom' )
));

Note : Here we are changing the text in the “Page” post type. If you want to add new post type and change the text according that, simple add the code in the step 3 again and change the labels accordingly.

Download the class file

Leave a Comment