CMS Scripts

How to Disable access in WordPress

How to Disable access in WordPress

Its Very useful if you have site with numerous authors for whom you do not want to allow the viewing of some key functions that are usually used by administrators. now we will learn How to Disable access in WordPress
But also  not to create too much confusion to customers novice. hide admin bar in wordpress.

With this short snippets you remove the menu on the control panel of wordpress.

The file to edit:  functions.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
 
if (!current_user_can( ‘level_10’  )) { //
add_action(‘wp_dashboard_setup’, ‘my_custom_dashboard_widgets’);
function my_custom_dashboard_widgets() {
   global $wp_meta_boxes;
   unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_right_now’]);
   unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_recent_drafts’]);
   unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_quick_press’]);
   unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_incoming_links’]);
   unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_plugins’]);
   unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_primary’]);
   unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_secondary’]);
}

Leave a Reply