Skip to content

Instantly share code, notes, and snippets.

@stephanieleary
Last active August 1, 2017 16:35
Show Gist options
  • Save stephanieleary/e96db15f0d8049a02cfc3af7c2d11f6e to your computer and use it in GitHub Desktop.
Save stephanieleary/e96db15f0d8049a02cfc3af7c2d11f6e to your computer and use it in GitHub Desktop.
Change post excerpt meta box title and contents
<?php
remove_meta_box( 'postexcerpt', 'post', 'side' );
// use original box:
// add_meta_box('postexcerpt', __( 'Plain Text Summary' ), 'post_excerpt_meta_box', 'post', 'normal', 'high');
// replace box altogether:
add_meta_box( 'postexcerpt', __( 'Plain Text Summary' ), 'custom_post_excerpt_meta_box', 'post', 'normal', 'high' );
function custom_post_excerpt_meta_box( $post ) {
?>
<label class="screen-reader-text" for="excerpt"><?php _e( 'Plain Text Summary' ) ?></label>
<textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
<p><?php
_e( 'The plain text summary will appear on archive pages (e.g. lists of posts by category) and in search results.' );
?></p>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment