How to change the wording in wp-admin back-end?

I don’t want to edit core files in order to change the page where a user enters new posts, so is there a way to do it within a theme, perhaps within functions.php ..?

Specifically, I’m trying to change the wording of the ‘Set featured image’ text to something like ‘Set featured image – 50 pixels by 50 pixels’

Related posts

Leave a Reply

3 comments

  1. You can use the filter admin_post_thumbnail_html:

    function custom_admin_post_thumbnail_html( $content ) {
        return $content = str_replace( __( 'Set featured image' ), __( 'Set featured image - 50 pixels by 50 pixels' ), $content );
    }
    
    add_filter( 'admin_post_thumbnail_html', 'custom_admin_post_thumbnail_html' );
    
  2. One way is to use careful jQuery code inserted in the header of the admin to modify the text within a specific part of the page. You need to be able to target a specific div/span/html tag in order to do so, but this system will let you edit any part of the page even if there is no filter (though the answer by Sorich has a great filter for the use-case in your question, my answer applies more generally to your question itself).

    I used the code below to alter the featured image box in 2.9 to say ‘featured image’ instead of ‘post thumbnail’ because the labels changed in 3.0 and I wanted my old site to use the new terminology before upgrading it.

    Note that the code handles both the popup box and the metabox, and uses some jquery AJAX functions to ensure the content gets re-modded after pageloads in the iframe.

    /**
     * Use jQuery to add context to the Featured Image metabox on post editing pages
     * and to change the label to be Featured Image instead of Post thumbnail in WP 2.9 
     * before the label changed.
     *
     * See javascript for info on removing these as they become part of the AP API
     */
    function gv_admin_featured_image_tweaks() {
        ?>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            /**
             * TEMPORARY: SWITCH VARIOUS LABELS TO SHOW FEATURED IMAGE INSTEAD OF POST THUMBNAIL
             * REMOVE WHEN 3.0 COMES OUT AND THIS IS THE DEFAULT LABEL
             */
            $('#postimagediv h3 span').text('Featured Image');
            // Only change the set thumbnail text if its that, otherwise we end up replacing the img tag when it is set
            if ($('#postimagediv #set-post-thumbnail').text() == 'Set thumbnail') {
                $('#postimagediv #set-post-thumbnail').text('Choose Featured Image');
            }
            $('#postimagediv #remove-post-thumbnail').text('Remove Featured Image');
    
            // label inside media item details in popup
            $('.wp-post-thumbnail').text('Use as Featured Image');
            // refresh inside media item for after upload finishes.
            $('body').ajaxComplete(function() {
                $('.wp-post-thumbnail').text('Use as Featured Image');
            });
    
            /**
             * Add a description of how we use featured images. should be replaced with a description parameter in the API
             */
            $('#postimagediv .inside').prepend('<p>This image will be used in the featured posts slider if this post is featured. It should be at least 400px wide by 300px tall.</p>');
        });
    </script>
        <?php
    }
    add_action('admin_head', 'gv_admin_featured_image_tweaks');
    
  3. Easier solution here:

    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.