Created
August 8, 2013 21:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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