Easily Disable Theme Changing In WordPress

Webmasters probably spent lots of time in customizing, creating and adding more specific features to theme for their client’s website and if by mistake your client switches to a new theme, deletes the old one could result in disaster.

So if you are also a website designer using WordPress to create client websites then here is a code snippet to remove “Themes” menu from “Appearances” section in your admin area dashboard. 

All you got to do is open your theme’s function.php file and add the following code:

add_action( ‘admin_init’, ‘slt_lock_theme’ );
function slt_lock_theme() {
global $submenu, $userdata;
if ( $userdata->ID != 1 ) {
unset( $submenu[‘themes.php’][5] );
unset( $submenu[‘themes.php’][15] );

Save changes and that’s it.

Earlier we have also discussed about disabling plugin and theme installation/update functionality in WordPress.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.