Created
October 9, 2020 16:26
-
-
Save vyskoczilova/b4ea5e4be68aeae6bed3603811561b6f to your computer and use it in GitHub Desktop.
Check if theme exists and is active or die
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
<?php | |
/** | |
* Plugin Name: Theme Guard | |
* Plugin URI: https://kybernaut.cz/?p=3204 | |
* Description: Check if theme exists and is active or die. | |
* Version: 0.0.1 | |
* Author: Karolína Vyskočilová | |
* Author URI: https://kybernaut.cz | |
* License: MIT | |
*/ | |
add_action('init', function () { | |
$current = wp_get_theme(); | |
$web = wp_get_theme('twentytwenty'); | |
if (!$web->exists() || $current->name !== $web->name) { | |
wp_die('An error occured. We\'ll fix it ASAP.'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment