WP CLI commands are disabled

[ad_1]

There is a function in the plugin.php __construct method for check_if_blocksy_is_activated(), and at the top of that function is a check to see if the request is coming from WPCLI:

public function check_if_blocksy_is_activated() {
  if (defined('WP_CLI') && WP_CLI) {
    return false;
  }

When coming from WPCLI, the check fails, which then fails to run the following init hook, which includes the loading of the WPCLI commands:

// Fails here, does not continue.
if (! $this->check_if_blocksy_is_activated()) {
  return;
}

$this->early_init_with_blocksy_theme();

// This init loads the WPCLI commands, but is never reached.
add_action('init', [$this, 'init'], 0);

Commenting out the if (defined('WP_CLI')... code then allows the WP CLI commands to be registered and available to use. I would recommend this snippet get removed, and then also add annotations for how the WP CLI commands work.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer