Show excerpt field in post editor

Not a first time I got a question: – How to show excerpt field in a post editor?
This metabox “Excerpt” is available to any user with access to the post/page editor. But it is hidden by default. To enable (show) it manually, a user need to turn on “Excerpt” checkbox at the “Screen Options”:

Show excerpt field manually

Yes, it quite easy to do, but not all users know and may find quick enough how to do it. If you have a lot of users right decision to make “Excerpt” field available by default programmatically.

Show Excerpt field programmatically

Just insert code below to your active theme ‘functions.php’ file:

add_filter('default_hidden_meta_boxes', 'show_hidden_meta_boxes', 10, 2);

function show_hidden_meta_boxes($hidden, $screen) {
    if ( 'post' == $screen->base ) {
        foreach($hidden as $key=>$value) {
            if ('postexcerpt' == $value) {
                unset($hidden[$key]);
                break;
            }
        }
    }
    
    return $hidden;
}

Full list of codes for other metaboxes hidden by default:
‘slugdiv’, ‘trackbacksdiv’, ‘postcustom’, ‘postexcerpt’, ‘commentstatusdiv’, ‘commentsdiv’, ‘authordiv’, ‘revisionsdiv’.

Share