Lot of useless comments on this post from what seems like a pretty simple question.
change below $theme_directory_name="twentyfourteen";
to your theme… thats all you have to do. First function sets your theme no matter what. Second one disables interface to edit themes.
function selfish_hardcoded_theme() {
$theme_directory_name="twentyfourteen";
add_filter( 'template', create_function( '$template', 'return "' . $theme_directory_name . '";' ) );
add_filter( 'stylesheet', create_function( '$stylesheet', 'return "' . $theme_directory_name . '";' ) );
}
add_action( 'setup_theme', 'selfish_hardcoded_theme', -1 );
add_filter( 'map_meta_cap', function( $required_caps, $cap ) {
if ( 'edit_themes' == $cap || 'switch_themes' == $cap || 'install_themes' == $cap || 'delete_themes' == $cap || 'update_themes' == $cap ) {
$required_caps[] = 'do_not_allow';
}
return $required_caps;
}, 10, 2 );
Theres other ways too :
$theme = wp_get_theme();
if ('twentyfourteen' !== $theme->name || 'twentyfourteen' !== $theme->parent_theme) {
switch_theme( 'twentyfourteen' );
}
You can also set the default theme constant in your wp-config.
Lastly, remove themes menu from admin:
function remove_themes_submenus() {
global $submenu;
unset($submenu['themes.php'][5]); // Removes 'Themes'
unset($submenu['themes.php'][15]); // Removes Theme Installer tab
}
add_action('admin_menu', 'remove_themes_submenus');