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

It will be useful to change the default “Featured 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

Sharing is caring!

Related Posts

Leave a Comment

shares