How to alter the text of the post “Excerpt” box label in WordPress post editor?

My theme gives the site owner the option of using each post’s “Excerpt” field to fill in the “meta description” tag for each page.

It would be helpful if I can filter the text label and description text that appears on the default Excerpt input control when viewed inside the post editor.

Read More

Does a filter or hook exist for this?

Alternately, I suppose I could use jQuery to do something via the DOM.

Related posts

Leave a Reply

3 comments

  1. there is a filter hook you can use and it is gettext
    here:

    add_filter( 'gettext', 'wpse22764_gettext', 10, 2 );
    function wpse22764_gettext( $translation, $original )
    {
        if ( 'Excerpt' == $original ) {
            return 'My Excerpt label';
        }else{
            $pos = strpos($original, 'Excerpts are optional hand-crafted summaries of your');
            if ($pos !== false) {
                return  'My Excerpt description';
            }
        }
        return $translation;
    }
    
  2. if anyone trying to add for a specific post type you can try this code

    add_filter('gettext', 'wp_video_link_excerpt_rename', 10, 2);
    function wp_video_link_excerpt_rename($translation, $original)
    {
        if (get_post_type( ) == 'video_link') {
            if ('Excerpt' == $original) {
                return 'Add Video Link';
            } else {
                $pos = strpos($original, 'Excerpts are optional hand-crafted summaries of your');
                if ($pos !== false) {
                    return  'Add any video link in the box above';
                }
            }
        }
        return $translation;
    }
    
  3. I used the original answer and modified it to handle different post types:

    // Customise the Excerpt field title and description via WP translation.
    // Change the $post_types array to change the default Excerpt metabox title and description. The description is generic but substitutes the post_type to make it specific to the current post type.
    
    add_filter( 'gettext', 'change_excerpt_info', 10, 2 );
    
    function change_excerpt_info ( $translation, $original ) {
        $post_types = array( "service", "workshop", 'team' );
        $post = get_post( $post );
        $posttype = '';
        if ( $post ) {
            $posttype =  $post->post_type;
        }
        if ( in_array($posttype, $post_types) ) {
            if ( 'Excerpt' == $original ) {
                 return ucfirst($posttype) . ' Teaser'; // Will appear as Service Teaser, Team Teaser, etc.
            } else $pos = strpos($original, 'Excerpts are optional hand-crafted summaries');
            if ($pos !== false) {
                // The Summary will incorporate the post_type into the description.
                $summary = 'This field will be displayed as a teaser or summary of anywhere this ' . $posttype . ' appears in a grid layout. You should always write a teaser of about 30 words. It will never be displayed on the actual ' . $posttype . ' page, so you can repeat content from other fields on this editing screen if you want.';
                  return $summary;
            }
        }
        return $translation;
    }