-
Notifications
You must be signed in to change notification settings - Fork 0
[Misc] Compatibility Check
picasso edited this page Apr 15, 2021
·
6 revisions
The Zukit framework is only compatible with WordPress version 5.3 or older, and PHP version 7.2 or older. The file load.php contains methods necessary for the check and also loads any required classes. In order to use the built-in compatibility test, it is recommended to initialize the framework and plugin/theme as follows:
// loads any required classes
require_once('zukit/load.php');
// compatibility check for Zukit
if(Zukit::is_compatible(__FILE__)) {
// I recommend defining your class in a different file to avoid errors
// with non compatible WP or PHP version
// load your plugin class
require_once('includes/myplugin.php');
// first call to the instance of your class
myplugin(__FILE__);
}You can change the minimum values of the required versions for your plugin/theme by passing additional parameters to the is_compatible method (but these values cannot be less than those required for Zukit to work) or define them in your plugin/theme header (see below):
/*
Plugin Name: My Plugin
Description: Wonderful plugin that will change this world.
Version: 1.0.0
Author: John Appleseed
Requires at least: 5.7.0
Requires PHP: 7.4.0
*/
// compatibility check for Zukit
if(Zukit::is_compatible(__FILE__, array(
'min_wp' => '5.4.0',
'min_php' => '7.3.0')
)) {
require_once('includes/myplugin.php');
myplugin(__FILE__);
}Zukit - The Developer Framework for WordPress