Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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 ));
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: Laravel Exclude URI from csrf token verification 
Php :: t_lnumber php 
Php :: PHP strpbrk — Search a string for any of a set of characters 
Php :: Find template serving current page 
Php :: php helper to get day from 0-6 
Php :: php executor 
Php :: add selected to dropdpown item laravel 
Php :: php get cookie by name preg_match 
Php :: if no data show msg and chang style laravel 
Php :: How to return custom error message from controller method validation 
Php :: preg match apache log file 
Php :: if gd is image 
Php :: costante php define 
Php :: laravel repository error 
Php :: php spellchecker 
Php :: Natural numbers from php 
Php :: can i do a relation between 2 coulnm in mongodb laravel 
Php :: PHP force refresh image 
Php :: __sleep and __wakeup 
Php :: escape class wordpress 
Php :: show file in folders phpstorm 
Php :: hide in nova laravel 
Php :: Lity in Wordpress 
Php :: print csv file in php 
Php :: how to add posts to php 
Php :: php echo to stderr 
Php :: doctrine remove element from arraycollection 
Php :: ajax call php bootstrap validation 
Php :: upload image to backend (see rest of the link) 
Php :: updateorinsert laravel for large data 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =