-
-
Save agustinprosperi/cebecfb95e27271bb06b to your computer and use it in GitHub Desktop.
Customize the Featured Image labels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 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