In relation to How to Display Post Excerpts in Admin by Default?, how would we go about removing the checkbox for Excerpt under screen options entirely for a complete solution?


You can do this with CSS.

.metabox-prefs label[for="postexcerpt-hide"] { 
    display: none; 

In regard to adding the CSS to the admin section, you have two options:

Option 1: Add the CSS to a stylesheet and enqueue it using the admin_enqueue_scripts hook.

function load_custom_wp_admin_style() {
  wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
  wp_enqueue_style( 'custom_wp_admin_css' );
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

Option 2: Add the CSS to a style tag using the admin_head hook.

function remove_post_excerpt_checkbox() {
      .metabox-prefs label[for="postexcerpt-hide"] { 
        display: none; 
add_action( 'admin_head', 'remove_post_excerpt_checkbox' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.