Jan
31

Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post

By Anish Lama  //  WordPress  //  15 Comments

I wasn’t surprised when one of my buyer asked me if there’s a way to hide features like tags, comments widgets. Its not uncommon in a simple CMS based projects where tags and comments widgets are seldom needed. Hence, I came up with a simple trick to hide those widgets.

Basically I used help of CSS ‘display:none’ to achieve it. I created a function ‘hide_wp_tags_from_admin’ and then I added this filter to to admin head using add_action. You must either create a plugin and add it to plugins folder or you can use a quick dirty hack by adding below function to function.php of your active theme.

function hide_wp_tags_from_admin() {
    echo '<!--
#commentsdiv, #tagsdiv-post_tag { display:none; }
-->';
}
add_action('admin_head', 'hide_wp_tags_from_admin');

Very simple; isn’t it? Have your say.

15 Comments to “Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post”

  • Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://bit.ly/dslKRK #wordpress #tip #trick

  • RT @designgala: Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://is.gd/7oS2X

  • RT @designgala: Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://is.gd/7oS2X

  • Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://is.gd/7oS2X #wordpress

  • RT @designgala: Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://is.gd/7oS2X #wordpress

  • RT @designgala: Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://is.gd/7oS2X #wordpress

  • [...] Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit … [...]

  • [...] the original post here: Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit … var addthis_pub = 'exil0r'; var addthis_language = 'en';var addthis_options = 'email, favorites, [...]

  • Social comments and analytics for this post…

    This post was mentioned on Twitter by wprocker: Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://bit.ly/dslKRK #wordpress #tip #trick…

  • [...] This post was mentioned on Twitter by Headup, raulblon, Michael Davis, Design Gala, WordPress Rocker and others. WordPress Rocker said: Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://bit.ly/dslKRK #wordpress #tip #trick [...]

  • Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://bit.ly/blXPKl

  • Simple Trick to Hide Tags, Comments widgets from WP-admin Add/Edit Post http://bit.ly/blXPKl

  • Your method leaves the hidden options visible in the “Screen Options” pane.

    A better method would be drop this code in your theme’s ‘functions.php’.
    [code]
    /*
    * Remove unwanted default meta boxes from posts
    */
    add_action( 'admin_menu', 'namespace_remove_meta_boxes');

    function namespace_remove_meta_boxes() {
    remove_meta_box('commentsdiv', 'post', 'normal'); // Remove comments
    remove_meta_box('revisionsdiv', 'post', 'normal'); // Remove revisions
    remove_meta_box('postexcerpt', 'post', 'normal'); // Remove excerpt
    remove_meta_box('formatdiv', 'post', 'normal'); // Remove format
    remove_meta_box('trackbacksdiv', 'post', 'normal'); // Remove trackbacks
    remove_meta_box('postcustom', 'post', 'normal'); // Remove custom fields
    remove_meta_box('authordiv', 'post', 'normal'); // Remove author
    remove_meta_box('postimagediv', 'post', 'normal'); // Remove featured image
    }
    [/code]

    • Thanks nigedo. :)

    • Thanks Nigedo. Had to add one line to hide the tags:
      remove_meta_box(‘tagsdiv-post_tag’, ‘post’, ‘normal’); // Remove tags

Leave a comment

ThemeForest
Recommend on Google

Sign up for our mailing list.