• When working with wp-cli and other plugins, wp-cassify output PHP notices like below bc $_SERVER[‘SERVER_NAME’] is not guaranteed to exist.

    $ php wp-cli.phar plugin activate wp-phpmyadmin-extension –url=/
    Notice: Undefined index: SERVER_NAME in /home1l/wordpres/www/wp-content/plugins/wp-cassify/classes/wp_cassify_utils.php on line 98

    I add this plugin to my wp-cli skip-plugins list as my fix.

    You might be able to get the current URL from code like one of these:

    if (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
    $current_url = $_SERVER['HTTP_HOST'];
    }

    if (defined(DOMAIN_CURRENT_SITE) && !empty(DOMAIN_CURRENT_SITE)) {
    $current_url = DOMAIN_CURRENT_SITE;
    }

    if (!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME'])) {
    $current_url = gethostname();
    }
  • You must be logged in to reply to this topic.