Skip to content

Commit 5a8e3ee

Browse files
committed
PHP version check from the theme info in styles.css header comment
1 parent 741ceeb commit 5a8e3ee

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

functions.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
* @package Starter Kit
1313
*/
1414

15-
if (PHP_VERSION_ID < 80100) {
16-
$activeTheme = wp_get_theme();
17-
$requiredPhpVersion = $activeTheme->get('RequiresPHP');
15+
$activeTheme = wp_get_theme();
16+
$requiredPhpVersion = $activeTheme->get('RequiresPHP');
1817

18+
if ($requiredPhpVersion && version_compare(PHP_VERSION, $requiredPhpVersion, '<')) {
1919
error_log(sprintf(__('Theme requires at least PHP %s (You are using PHP %s) '), $requiredPhpVersion, PHP_VERSION));
20-
if (!is_admin()) {
21-
wp_die(__('Theme requires a higher PHP Version. Please check the Logs for more details.'));
22-
}
20+
wp_die(__('Theme requires a higher PHP Version. Please check the Logs for more details.'));
2321
} else {
2422
try {
2523
// helper debug functions for developers

0 commit comments

Comments
 (0)