Trucchi WordPress: Rimuovere i menu dalla bacheca

La bacheca di WordPress è molto importante nella struttura di un blog. Permette di controllare i post, le notifiche, e molte altre cose che di solito possiamo ritenere utili. Quando si costruisce un sito in wordpress per un cliente è particolarmente comodo riuscire ad avere il controllo della bacheca, eliminando la possibilità di accedere a determinate voci del menu.


Con questo semplicescript per wordpress potrete rimuovere l’accesso ad alcuni menu della bacheca cosi da evitare che il cliente possa accidentalmente far danni.

PROCEDURA:
1) Copiate il codice seguente codice nel file functions.php presente nella directory principale del vostro tema.
2) Nell’array $restricted indicate tutte le voci di menu che volete eliminare.
3) Salvate il file.


function remove_menus () {
global $menu;
$restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}
}
add_action('admin_menu', 'remove_menus');

Via | catswhocode

Panoramica privacy

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.