title: Using WPI_CLI in WordPress theme's functions.php
body: <p>I am trying to execute a command from within my theme's functions.php using the method described here: <a href="https://make.wordpress.org/cli/handbook/internal-api/wp-cli-runcommand/" rel="nofollow noreferrer">https://make.wordpress.org/cli/handbook/internal-api/wp-cli-runcommand/</a></p>
  
  <p>And I am getting the following error:</p>
  
  <p><code>"Class 'WP_CLI' not found"</code></p>
  
  <p>I've wrapped my function in the following code, which gets rid of the error:</p>
  
  <p><code>if ( class_exists( 'WP_CLI' ) ) { }</code></p>
  
  <p>However...  I still need to figure out how can I make it so my theme's functions.php file correctly loads the WP_CLI class?  </p>
  
  <p>I have WP_CLI installed and am using it fine via command-line, but I am trying to add some extra functionality that would have it execute from a function within my theme.</p>
  
  <p>Thank you for any help that you can provide.</p>