[resolved] relabel "Featured Image" on custom type (5 posts)

  1. Shasta
    Posted 4 years ago #

    I'm really liking custom types for the ability to make a much friendlier UI for less technical content creators.

    I'd like to relabel "Featured Image" to "Book Cover" without changing the way it works -- I just want to change the label, and ideally the link text too.

    Can someone point me to the way to do this? My google-fu is failing.

  2. Chouby
    Posted 4 years ago #

    If you are ready to write some code, I believe that the filter 'admin_post_thumbnail_html' can do what you want.

    You can look how WordPress outputs the metabox by looking at the function '_wp_post_thumbnail_html' in the file wp-admin/includes/post.php

    I found this too.

  3. Shasta
    Posted 4 years ago #

    Thank you Chouby. The linked article helped me figure out how to change the link-text on only the one custom type lit_bookinfo:

    function change_thumbnail_html( $content ) {
        if ('lit_bookinfo' == $GLOBALS['post_type'])
    function do_thumb($content){
    	 return str_replace(__('Set featured image'), __('Book Cover'),$content);

    I haven't found a way to change the actual title of the metabox except to use jQuery. I'm not sure why that seems so wrong ... I may still choose to do that if I decide this is still confusing for authors.

    I'm going to leave this open for now in case anyone knows how to change the title of the metabox.

  4. Chouby
    Posted 4 years ago #

    An alternative to JQuery for the title would be to access directly to the variable containing the title.

    It should be in the global variable $wp_meta_boxes at the index $wp_meta_boxes['post']['side']['low']['postimagediv']['title']

    Replacing 'post' by your post type should be OK I guess

  5. Robert
    Posted 4 years ago #

    @shastaw - Thanks! That is exactly what I've been looking for. I found out how to change the actual title of the metabox:

    add_action('do_meta_boxes', 'change_image_box');
    function change_image_box()
        remove_meta_box( 'postimagediv', 'custom_post_type', 'side' );
        add_meta_box('postimagediv', __('New Text'), 'post_thumbnail_meta_box', 'custom_post_type', 'normal', 'high');

    custom_post_type should be the custom post type you want it to appear on
    New Text is the text you want to replace 'Featured Image'

    Note: Above code also moves the featured image box from the side to area under the editor.

Topic Closed

This topic has been closed to new replies.

About this Topic