-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check to ensure site is using WordPress 4.8 (#1319)
- Loading branch information
1 parent
5eceb50
commit 537f436
Showing
2 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Verify that we can initialize the Gutenberg editor plugin. | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
die( 'Silence is golden.' ); | ||
} | ||
|
||
/** | ||
* Display a notice and deactivate the Gutenberg plugin. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
function gutenberg_wordpress_version_notice() { | ||
echo '<div class="error"><p>'; | ||
echo __( 'Gutenberg requires WordPress 4.8 or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ); | ||
echo '</p></div>'; | ||
|
||
deactivate_plugins( array( 'gutenberg/gutenberg.php' ) ); | ||
} | ||
|
||
/** | ||
* Verify that we can initialize the Gutenberg editor plugin. | ||
* | ||
* @since 0.1.0 | ||
* @return bool Whether we can initialize the plugin. | ||
*/ | ||
function gutenberg_can_init() { | ||
global $wp_version; | ||
|
||
if ( version_compare( $wp_version, '4.8', '<' ) ) { | ||
add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' ); | ||
return false; | ||
} | ||
|
||
return true; | ||
} |