Skip to content

Instantly share code, notes, and snippets.

@slushman
Last active December 28, 2015 08:49
Show Gist options
  • Save slushman/454cc8b26c330727df13 to your computer and use it in GitHub Desktop.
Save slushman/454cc8b26c330727df13 to your computer and use it in GitHub Desktop.
Customize the Featured Image labels
/**
* Changes strings referencing Featured Images for a post type
*
* In this example, the post type in the filter name is "employee"
* and the new reference in the labels is "headshot".
*
* @see https://developer.wordpress.org/reference/hooks/post_type_labels_post_type/
*
* @param object $labels Current post type labels
* @return object Modified post type labels
*/
function change_featured_image_labels( $labels ) {
$labels->featured_image = 'Headshot';
$labels->set_featured_image = 'Set headshot';
$labels->remove_featured_image = 'Remove headshot';
$labels->use_featured_image = 'Use as headshot';
return $labels;
} // change_featured_image_labels()
add_filter( 'post_type_labels_employee', 'change_featured_image_labels', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment