How to change custom post type featured image metabox title and text labels?

Ok! Old question with multiple answers of the same wrong approach using different hooks! In case anyone needs, I'm posting a better way of doing this, without using extra hooks or editing metaboxes.

When registering a new CPT using register_post_type function, we can (and should!) pass a labels array to it's arguments. Some of these labels are for CPT edit screen.

$labels = [
    'name'                  => __( 'Banks', 'textdomain' ),
    'singular_name'         => __( 'Bank', 'textdomain' ),
    'add_new'               => __( 'Add New', 'textdomain' ),
    'add_new_item'          => __( 'Add New Bank', 'textdomain' ),  //used in post-new.php?post_type=bank
    'edit_item'             => __( 'Edit Bank', 'textdomain' ), //used in post.php
    'new_item'              => __( 'New Bank', 'textdomain' ),
    'all_items'             => __( 'All Banks', 'textdomain' ),
    'view_item'             => __( 'Vew Bank', 'textdomain' ),
    'search_items'          => __( 'Search Banks', 'textdomain' ),
    'not_found'             => __( 'No banks found', 'textdomain' ),
    'not_found_in_trash'    => __( 'No banks found in trash', 'textdomain' ),
    'parent_item_colon'     => __( 'Parent bank', 'textdomain' ),
    'menu_name'             => __( 'Banks', 'textdomain' ),
    'featured_image'        => __( 'Bank image', 'textdomain' ),    //used in post.php
    'set_featured_image'    => __( 'Set bank image', 'textdomain' ),    //used in post.php
    'remove_featured_image' => __( 'Remove bank image', 'textdomain' ), //used in post.php
    'use_featured_image'    => __( 'Use as bank image', 'textdomain' ), //used in post.php
    'insert_into_item'      => __( 'Insert into bank', 'textdomain' ),  //used in post.php
    'uploaded_to_this_item' => __( 'Uploaded to this bank', 'textdomain' ), //used in post.php
    'filter_items_list'     => __( 'Filter banks', 'textdomain' ),
    'items_list_navigation' => __( 'Banks navigation', 'textdomain' ),
    'items_list'            => __( 'Banks list', 'textdomain' ),
];

$args = [
    'description'           =>  'Bank CPT',
    'public'                =>  false,
    'show_ui'               =>  true,
    'show_in_menu'          =>  true,
    'show_in_admin_bar'     =>  false,
    'has_archive'           =>  false,
    'labels'                =>  $labels,
    'supports'              =>  ['thumbnail'],
    'query_var'             =>  false,
    'can_export'            =>  true,
    'show_in_rest'          =>  false,
];

register_post_type('bank', $args);

Just making a little more easier to understand:

add_action( 'admin_head', 'replace_default_featured_image_meta_box', 100 );
function replace_default_featured_image_meta_box() {
    remove_meta_box( 'postimagediv', 'my-post-type-here', 'side' );
    add_meta_box('postimagediv', __('My Cover Image'), 'post_thumbnail_meta_box', 'my-post-type-here', 'side', 'high');
}

The main idea is: re-declaring the meta-box with the required title. Replace the post-type for which you want to edit the default "Featured Image" label.


I just found the sulotion.

Here is an example.

add_action( 'admin_head', 'remove_my_meta_boxen' );
function remove_my_meta_boxen() {
    remove_meta_box( 'postimagediv', 'banks', 'side' );
    add_meta_box('postimagediv', __('Add a bank image'), 'post_thumbnail_meta_box', 'banks', 'side', 'high');
}

Happy coding.