Skip to content

Instantly share code, notes, and snippets.

@sambody
Created August 8, 2013 21:06
Show Gist options
  • Save sambody/6188734 to your computer and use it in GitHub Desktop.
Save sambody/6188734 to your computer and use it in GitHub Desktop.
Disable theme switching for all (or all except admin) by hiding theme menu item under Appearance
// disable theme switching by hiding theme item - for all except admin (id 1)
add_action( ‘admin_init’, ‘slt_lock_theme’ );
function slt_lock_theme() {
global $submenu, $userdata;
get_currentuserinfo();
if ( $userdata->ID != 1 ) {
unset( $submenu['themes.php'][5] );
unset( $submenu['themes.php'][15] );
}
}
// disable theme switching by hiding theme item - for all
add_action( ‘admin_init’, ‘wplg_lock_theme’ );
function wplg_lock_theme() {
global $submenu;
unset( $submenu['themes.php'][5] );
unset( $submenu['themes.php'][15] );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment