{"id":3073,"date":"2014-01-16T23:53:40","date_gmt":"2014-01-17T03:53:40","guid":{"rendered":"http:\/\/shinephp.com\/?p=3073"},"modified":"2014-06-12T11:04:55","modified_gmt":"2014-06-12T15:04:55","slug":"hide-widgets-wordpress-dashboard","status":"publish","type":"post","link":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/","title":{"rendered":"Hide widgets from WordPress dashboard"},"content":{"rendered":"<p><div id=\"attachment_3074\" style=\"width: 210px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png\"><img aria-describedby=\"caption-attachment-3074\" loading=\"lazy\" src=\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png\" alt=\"Cleanup WP dashboard\" width=\"200\" height=\"200\" class=\"size-full wp-image-3074\" srcset=\"https:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png 200w, https:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard-150x150.png 150w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/><\/a><p id=\"caption-attachment-3074\" class=\"wp-caption-text\">Cleanup WP dashboard<\/p><\/div> A lot of WordPress plugins adds widgets to WordPress administrator dashboard automatically. Some time you may wish to hide selected widget, &#8211; may be it is not interested for you, or may be it even does not contain a bit of useful information.<\/p>\n<p>Some of plugins were written with user friendly policy in a mind and has an option at their settings to hide selected widget. What to do with plugin which does not allow blog owner to manage what widget to show at the WordPress back-end dashboard and what does not?<\/p>\n<p>Yes, any user may hide unneeded widget switching of correspondent checkbox inside the &#8220;Screen Options&#8221; at the top of the page. But suppose, that You, as administrator, wish to make your blog dashboard more user friendly and to help your users to spend their time more effectively. Some times you even do not wish to let user know, that some widget is available at all. Use this recipe to make your dashboard cleaner.<!--more--><br \/>\nLet use as an example the widgets from <a href=\"http:\/\/www.visser.com.au\/plugins\/commission-king\/\">&#8220;WooCommerce &#8211; Commissions King&#8221;<\/a> plugin from Visser Labs. Look at the picture below:<br \/>\n<div id=\"attachment_3075\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/visser-labs-dashboard-widgets.png\"><img aria-describedby=\"caption-attachment-3075\" loading=\"lazy\" src=\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/visser-labs-dashboard-widgets.png\" alt=\"WooCommerce - Commission Kings plugin widgets\" width=\"590\" height=\"340\" class=\"size-full wp-image-3075\" srcset=\"https:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/visser-labs-dashboard-widgets.png 590w, https:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/visser-labs-dashboard-widgets-300x172.png 300w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/a><p id=\"caption-attachment-3075\" class=\"wp-caption-text\">Dashboard widgets from Visser Labs WooCommerce  &#8211; Commissions King plugin<\/p><\/div><br \/>\nThe &#8220;WooCommerce Plugin News&#8221; box is always empty. &#8220;WooCommerce Plugins&#8221; widget contains &#8220;WooCommerce &#8211; Commissions King&#8221; item only. I suppose that it shows those plugins only that you have installed. Is it interesting for you? You know already that you use this plugin. You even remember that you paid for it. And there is no need in such widget in both cases, right? Any way there is the &#8220;Plugins&#8221; menu, where you may always check the current version of the plugin and updates availability. <\/p>\n<p>I think, that widgets of this sort should be placed somewhere at the plugin settings pages (separate tab or not) and do not bother all users any time they login to their lovely WordPress.<\/p>\n<p>Now let&#8217;s proceed with the &#8220;magic&#8221; part of this post. Right click on the widget you wish to hide. Select &#8220;Inspect element&#8221; menu item if you use Google Chrome browser or similar one, if you use other browser.<\/p>\n<p><div id=\"attachment_3076\" style=\"width: 674px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/plugins-news-widget-div-id.png\"><img aria-describedby=\"caption-attachment-3076\" loading=\"lazy\" src=\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/plugins-news-widget-div-id.png\" alt=\"Woocommerce Plugin News widget div id\" width=\"664\" height=\"284\" class=\"size-full wp-image-3076\" srcset=\"https:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/plugins-news-widget-div-id.png 664w, https:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/plugins-news-widget-div-id-300x128.png 300w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><p id=\"caption-attachment-3076\" class=\"wp-caption-text\">Woocommerce Plugin News widget div id<\/p><\/div><br \/>\nAt the HTML code opened look for the div ID which contains the widget. In our example it is &#8216;woo_vl_news_widget&#8217;. The task is almost complete.<br \/>\nOpen blog&#8217;s active theme <code>functions.php<\/code> file at your favorite text editor and add to the end this piece of code:<\/p>\n<pre lang=\"php\" line=\"1\">\r\nfunction remove_dashboard_widgets() {\r\n    \/\/ remove WooCommerce Plugin News - by Visser Labs   \r\n    remove_meta_box( 'woo_vl_news_widget', 'dashboard', 'normal');\r\n    \r\n    \/\/ remove WooCommerce Plugins - by Visser Labs\r\n    remove_meta_box( 'woo_vm_status_widget', 'dashboard', 'normal');    \r\n}\r\nadd_action('wp_user_dashboard_setup', 'remove_dashboard_widgets', 20);\r\nadd_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20);\r\n<\/pre>\n<p>As you see we placed widget div IDs (&#8216;woo_vl_news_widget&#8217; and &#8216;woo_vm_status_widget&#8217;) found at page HTML to the <code>remove_meta_box()<\/code> function call.<br \/>\nWe got it. Widgets which you don&#8217;t wish to see were hidden.<br \/>\nAnd you may do it with any widget now, just find its div ID, and <code>remove_meta_box()<\/code> with that ID as parameter.<\/p>\n<p>In case you wish to hide some widget not from all users but from the user with selected user role or capability assigned, enclose code above with <code>current_user_can()<\/code> function result check, e.g. below:<\/p>\n<pre lang=\"php\" line=\"1\">\r\nif (current_user_can('subscriber')) {\r\n    function remove_dashboard_widgets() {\r\n        \/\/ remove WooCommerce Plugin News - by Visser Labs   \r\n        remove_meta_box( 'woo_vl_news_widget', 'dashboard', 'normal');\r\n    \r\n        \/\/ remove WooCommerce Plugins - by Visser Labs\r\n        remove_meta_box( 'woo_vm_status_widget', 'dashboard', 'normal');    \r\n    }\r\n    add_action('wp_user_dashboard_setup', 'remove_dashboard_widgets', 20);\r\n    add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20);\r\n} \/\/ if \r\n<\/pre>\n<p>In order to change WordPress user roles and capabilities I recommend you to use the <a href=\"http:\/\/role-editor.com\">&#8220;User Role Editor&#8221;<\/a> plugin.<\/p>\n<p>Happy blogging!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A lot of WordPress plugins adds widgets to WordPress administrator dashboard automatically. Some time you may wish to hide selected widget, &#8211; may be it is not interested for you, or may be it even does not contain a bit of useful information. Some of plugins were written with user friendly policy in a mind [&hellip;]<\/p>\n","protected":false},"author":375,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[4],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hide widgets from WordPress dashboard - ShinePHP.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hide widgets from WordPress dashboard - ShinePHP.com\" \/>\n<meta property=\"og:description\" content=\"A lot of WordPress plugins adds widgets to WordPress administrator dashboard automatically. Some time you may wish to hide selected widget, &#8211; may be it is not interested for you, or may be it even does not contain a bit of useful information. Some of plugins were written with user friendly policy in a mind [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/\" \/>\n<meta property=\"og:site_name\" content=\"ShinePHP.com\" \/>\n<meta property=\"article:published_time\" content=\"2014-01-17T03:53:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-06-12T15:04:55+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vladimir Garagulya\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/shinephp.com\/#website\",\"url\":\"https:\/\/shinephp.com\/\",\"name\":\"ShinePHP.com\",\"description\":\"WordPress, PHP, MySQL, general WEB development hints, reviews, plugins, news...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/shinephp.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#primaryimage\",\"url\":\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png\",\"contentUrl\":\"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#webpage\",\"url\":\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/\",\"name\":\"Hide widgets from WordPress dashboard - ShinePHP.com\",\"isPartOf\":{\"@id\":\"https:\/\/shinephp.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#primaryimage\"},\"datePublished\":\"2014-01-17T03:53:40+00:00\",\"dateModified\":\"2014-06-12T15:04:55+00:00\",\"author\":{\"@id\":\"https:\/\/shinephp.com\/#\/schema\/person\/6e92de27868308b6eb5d5b51d53278b5\"},\"breadcrumb\":{\"@id\":\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hide widgets from WordPress dashboard\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/shinephp.com\/#\/schema\/person\/6e92de27868308b6eb5d5b51d53278b5\",\"name\":\"Vladimir Garagulya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/shinephp.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f47aa9fa1c924d322a80325eae671b37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f47aa9fa1c924d322a80325eae671b37?s=96&d=mm&r=g\",\"caption\":\"Vladimir Garagulya\"},\"sameAs\":[\"http:\/\/shinephp.com\"],\"url\":\"https:\/\/shinephp.com\/author\/admin80w7rgrd\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hide widgets from WordPress dashboard - ShinePHP.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/","og_locale":"en_US","og_type":"article","og_title":"Hide widgets from WordPress dashboard - ShinePHP.com","og_description":"A lot of WordPress plugins adds widgets to WordPress administrator dashboard automatically. Some time you may wish to hide selected widget, &#8211; may be it is not interested for you, or may be it even does not contain a bit of useful information. Some of plugins were written with user friendly policy in a mind [&hellip;]","og_url":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/","og_site_name":"ShinePHP.com","article_published_time":"2014-01-17T03:53:40+00:00","article_modified_time":"2014-06-12T15:04:55+00:00","og_image":[{"url":"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png"}],"twitter_misc":{"Written by":"Vladimir Garagulya","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/shinephp.com\/#website","url":"https:\/\/shinephp.com\/","name":"ShinePHP.com","description":"WordPress, PHP, MySQL, general WEB development hints, reviews, plugins, news...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/shinephp.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#primaryimage","url":"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png","contentUrl":"http:\/\/shinephp.com\/wp-content\/uploads\/2014\/01\/cleanup-wp-dashboard.png"},{"@type":"WebPage","@id":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#webpage","url":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/","name":"Hide widgets from WordPress dashboard - ShinePHP.com","isPartOf":{"@id":"https:\/\/shinephp.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#primaryimage"},"datePublished":"2014-01-17T03:53:40+00:00","dateModified":"2014-06-12T15:04:55+00:00","author":{"@id":"https:\/\/shinephp.com\/#\/schema\/person\/6e92de27868308b6eb5d5b51d53278b5"},"breadcrumb":{"@id":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/shinephp.com\/hide-widgets-wordpress-dashboard\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hide widgets from WordPress dashboard"}]},{"@type":"Person","@id":"https:\/\/shinephp.com\/#\/schema\/person\/6e92de27868308b6eb5d5b51d53278b5","name":"Vladimir Garagulya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/shinephp.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f47aa9fa1c924d322a80325eae671b37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f47aa9fa1c924d322a80325eae671b37?s=96&d=mm&r=g","caption":"Vladimir Garagulya"},"sameAs":["http:\/\/shinephp.com"],"url":"https:\/\/shinephp.com\/author\/admin80w7rgrd\/"}]}},"_links":{"self":[{"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/posts\/3073"}],"collection":[{"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/users\/375"}],"replies":[{"embeddable":true,"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/comments?post=3073"}],"version-history":[{"count":0,"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/posts\/3073\/revisions"}],"wp:attachment":[{"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/media?parent=3073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/categories?post=3073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinephp.com\/wp-json\/wp\/v2\/tags?post=3073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}