Answers for "wordpress plugin to check php version and wordpress version"

SQL
0

find wordpress version in database

/* Make sure to consult the codex, as the db_version looks different from the wp version. */
/* https://codex.wordpress.org/WordPress_Versions */
SELECT * FROM `wp_options` where option_name = 'db_version'
Posted by: Guest on October-07-2020
0

Check php and wordpress version before activation

register_activation_hook(__FILE__, 'check_version');
function check_version() {
    $php_version_required = '5.6';
    $wp_version_required  = '4.8';
    
    if ( version_compare( PHP_VERSION, $php_version_required, '<' ) ) {
        deactivate_plugins( basename(__FILE__) );
		wp_die(sprintf( esc_html__( 'This plugin can not be activated because it requires a PHP version greater than %1$s. Please update your PHP version before you activate it.', 'OETFA-GOOGLE-2FA-RECAPTCHA' ), $php_version_required ), 'Error', array( 'back_link' => true ));
    }
    
    if ( version_compare($wp_version, $wp_version_required, '<') ) {
        deactivate_plugins( basename(__FILE__) );
		wp_die(sprintf( esc_html__( 'This plugin can not be activated because it requires a WordPress version greater than %1$s. Please go to Dashboard -> Updates to get the latest version of WordPress.', 'OETFA-GOOGLE-2FA-RECAPTCHA' ), $wp_version_required ), 'Error', array( 'back_link' => true ));
    }
}
Posted by: Guest on September-07-2021

Code answers related to "wordpress plugin to check php version and wordpress version"

Code answers related to "SQL"

Browse Popular Code Answers by Language