Skip to content

Instantly share code, notes, and snippets.

@bdeleasa
Created July 9, 2015 16:01
Show Gist options
  • Save bdeleasa/1f034bb344ddabec557d to your computer and use it in GitHub Desktop.
Save bdeleasa/1f034bb344ddabec557d to your computer and use it in GitHub Desktop.
A Wordpress plugin that renames the Featured Image metabox and text.
@esl4m
Copy link

esl4m commented Jan 17, 2016

Hello ,
Good work 👍

This block
function wp_rename_featured_image_post_thumbnail_html( $content ) {
global $current_screen;
if( $current_screen->post_type !== 'post' ) {
return $content;
}
$content = str_replace( __( 'Set featured image' ), __( 'Upload Post Image' ), $content);
$content = str_replace( __( 'Remove featured image' ), __( 'Remove Post Image' ), $content);
return $content;
}
add_action( 'do_meta_boxes', 'wp_rename_featured_image_do_meta_boxes' );

On my case custom_post_type will replace only "Set featured image"
But replacing "Remove featured image" link will not work ...

and I would recommend this block for editing both

// Rename the featured image text.
function rename_set_featured_image( $content ) {
return $content = str_replace( __( 'Set featured image' ), __( 'Set product logo' ), $content );
}
add_filter( 'admin_post_thumbnail_html', 'rename_set_featured_image' );

// Rename the Remove featured image text.
function rename_remove_featured_image( $content ) {
return str_replace( 'Remove featured image', 'Remove product logo', $content );
}
add_filter( 'admin_post_thumbnail_html', 'rename_remove_featured_image', 9999, 1 );

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment