4 added 532 characters in body
source | link

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action( 'admin_notices', 'my_plugin_admin_notices' );

function my_plugin_admin_notices() {
    if ( ! is_plugin_active( 'hello.php' ) && isset( $_GET['customhello'] ) ) {
        echo '<div class="error"><p>WordPress need to be at least 8.5 to activate this plugin</p></div>';
    }
}

add_action( 'activate_plugin', '_20170113_superess_activate', 10, 2 );

function _20170113_superess_activate( $plugin, $network_wide ) {
    global $wp_version;
    if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url( 'plugins.php?customhello=1' );
        wp_redirect( $redirect );
        exit;
    }
}

enter image description here

Please note that when you try to activate the plugin you interact with plugins.php file. In there you have a big switch of actions that you can run.

And in case you have the error set $_GET['error'] at the moment you have just the predefined error messages — you cannot create your own custom message. This is why I proposed you the solution like this.

enter image description here

One may propose the custom messages as admin notices to the WordPress core in cases plugins do not meet some requirements.

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action( 'admin_notices', 'my_plugin_admin_notices' );

function my_plugin_admin_notices() {
    if ( ! is_plugin_active( 'hello.php' ) && isset( $_GET['customhello'] ) ) {
        echo '<div class="error"><p>WordPress need to be at least 8.5 to activate this plugin</p></div>';
    }
}

add_action( 'activate_plugin', '_20170113_superess_activate', 10, 2 );

function _20170113_superess_activate( $plugin, $network_wide ) {
    global $wp_version;
    if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url( 'plugins.php?customhello=1' );
        wp_redirect( $redirect );
        exit;
    }
}

enter image description here

Since you updated the title I need to provide the another answer, the previous one please don't ignore because it is even more simple than this one.

add_action( 'admin_notices', 'my_plugin_admin_notices' );

function my_plugin_admin_notices() {
    if ( ! is_plugin_active( 'hello.php' ) && isset( $_GET['customhello'] ) ) {
        echo '<div class="error"><p>WordPress need to be at least 8.5 to activate this plugin</p></div>';
    }
}

add_action( 'activate_plugin', '_20170113_superess_activate', 10, 2 );

function _20170113_superess_activate( $plugin, $network_wide ) {
    global $wp_version;
    if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url( 'plugins.php?customhello=1' );
        wp_redirect( $redirect );
        exit;
    }
}

enter image description here

Please note that when you try to activate the plugin you interact with plugins.php file. In there you have a big switch of actions that you can run.

And in case you have the error set $_GET['error'] at the moment you have just the predefined error messages — you cannot create your own custom message. This is why I proposed you the solution like this.

enter image description here

One may propose the custom messages as admin notices to the WordPress core in cases plugins do not meet some requirements.

3 small formatting effort.
source | link

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action( 'admin_notices', 'my_plugin_admin_notices' );

function my_plugin_admin_notices() {
    if ( ! is_plugin_active( 'hello.php' ) && isset( $_GET['customhello'] ) ) {
        echo "<div'<div class='error'><p>WordPressclass="error"><p>WordPress need to be at least 8.5 to activate this plugin</p></div>";div>';
    }
}

 

add_action( 'activate_plugin', '_20170113_superess_activate' , 10, 2 );

    function _20170113_superess_activate( $plugin, $network_wide ) {
 
      global $wp_version;
 
      if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url( 'plugins.php?customhello=1' );        
        wp_redirect( $redirect );
        exit;   


      }
 
    }

enter image description here

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action('admin_notices', 'my_plugin_admin_notices');

function my_plugin_admin_notices() {
    if (!is_plugin_active('hello.php') && isset($_GET['customhello']) ) {
        echo "<div class='error'><p>WordPress need to be at least 8.5 to activate this plugin</p></div>";
    }
}

 

add_action( 'activate_plugin', '_20170113_superess_activate' , 10, 2);

    function _20170113_superess_activate($plugin, $network_wide){
 
      global $wp_version;
 
      if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url('plugins.php?customhello=1' );        
        wp_redirect($redirect);
        exit;   


      }
 
    }

enter image description here

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action( 'admin_notices', 'my_plugin_admin_notices' );

function my_plugin_admin_notices() {
    if ( ! is_plugin_active( 'hello.php' ) && isset( $_GET['customhello'] ) ) {
        echo '<div class="error"><p>WordPress need to be at least 8.5 to activate this plugin</p></div>';
    }
}

add_action( 'activate_plugin', '_20170113_superess_activate', 10, 2 );

function _20170113_superess_activate( $plugin, $network_wide ) {
    global $wp_version;
    if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url( 'plugins.php?customhello=1' );
        wp_redirect( $redirect );
        exit;
    }
}

enter image description here

2 added 91 characters in body
source | link

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action('admin_notices', 'my_plugin_admin_notices');

function my_plugin_admin_notices() {
    if (!is_plugin_active('hello.php') && isset($_GET['customhello']) ) {
        echo "<div class='error'><p>WordPress need to be at least 8.5 to activate this plugin</p></div>";
    }
}



add_action( 'activate_plugin', '_20170113_superess_activate' , 10, 2);

    function _20170113_superess_activate($plugin, $network_wide){

      global $wp_version;

      if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url('plugins.php?customhello=1' );        
        wp_redirect($redirect);
        exit;   


      }

    }

enter image description here

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action('admin_notices', 'my_plugin_admin_notices');

function my_plugin_admin_notices() {
    if (!is_plugin_active('hello.php') && isset($_GET['customhello']) ) {
        echo "<div class='error'><p>WordPress need to be at least 8.5 to activate this plugin</p></div>";
    }
}



add_action( 'activate_plugin', '_20170113_superess_activate' , 10, 2);

    function _20170113_superess_activate($plugin, $network_wide){

      global $wp_version;

      if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url('plugins.php?customhello=1' );        
        wp_redirect($redirect);
        exit;   


      }

    }

Since you updated the title I need to provide the another answer, the previous one please don't ignore, because it is even more simple than this one.

add_action('admin_notices', 'my_plugin_admin_notices');

function my_plugin_admin_notices() {
    if (!is_plugin_active('hello.php') && isset($_GET['customhello']) ) {
        echo "<div class='error'><p>WordPress need to be at least 8.5 to activate this plugin</p></div>";
    }
}



add_action( 'activate_plugin', '_20170113_superess_activate' , 10, 2);

    function _20170113_superess_activate($plugin, $network_wide){

      global $wp_version;

      if ( $wp_version < 8.5 && 'hello.php' == $plugin ) {
        $redirect = self_admin_url('plugins.php?customhello=1' );        
        wp_redirect($redirect);
        exit;   


      }

    }

enter image description here

1
source | link