RSS

How To Change “Set Featured Image” Text In WordPress

13 Sep

In some cases, you may wish to change the text “Set Featured Image” inside “Featured Image” admin widget. In my last project, I had to create a custom post type to upload images to a slider. The custom post type contained only title and Featured Image Box. I had to change the “Set Featured Image” text to “Upload Slider Image”. This is how I did it.

 

1
2
3
4
5
6
7
8
9
function custom_admin_post_thumbnail_html( $content ) {
    global $current_screen;
    if( ‘slider_post’ == $current_screen->post_type )
        return $content = str_replace( __( ‘Set featured image’ ), __( ‘Upload Slider Image’ ), $content);
    else
        return $content;
}
add_filter( ‘admin_post_thumbnail_html’, ‘custom_admin_post_thumbnail_html’ );

 

Above code was added to my theme functions.php file. Also slider_post is the name of my custom post type. If the “if” condition was not there, the text change will be applied to all post types including posts, pages etc.

Advertisements
 
Leave a comment

Posted by on September 13, 2013 in Wordpress

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: