title: Call for undefined function in Wordpress plugin
body: <p>I'm currently writing a WordPress plugin that works with WooCommerce. I query WooCommerce orders and the goal is to use the adresses of those orders to plan a delivery route using the API from a Dutch route planner service.</p>
  
  <p>It's been a while writing PHP for me, the last PHP I wrote was 7 years ago, so my PHP skills are a bit rusty.</p>
  
  <p>After I query my orders, I want to call the function routexl_generate(), this function is defined in my code. However, running code this throws the following error:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Call to undefined function routexl_generate() in /home/u48469p44993/domains/dev.geusdiervoeding.nl/public_html/wp-content/plugins/geusdiervoeding-wc-rxlplanner/geusdiervoeding-wc-rxlplanner.php:120 Stack trace: #0 /home/u48469p44993/domains/dev.geusdiervoeding.nl/public_html/wp-content/plugins/geusdiervoeding-wc-rxlplanner/geusdiervoeding-wc-rxlplanner.php(100): wc_order_query() #1 /home/u48469p44993/domains/dev.geusdiervoeding.nl/public_html/wp-includes/class-wp-hook.php(288): rxlp_menu_init('') #2 /home/u48469p44993/domains/dev.geusdiervoeding.nl/public_html/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array) #3 /home/u48469p44993/domains/dev.geusdiervoeding.nl/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #4 /home/u48469p44993/domains/dev.geusdiervoeding.nl/public_html/wp-admin/admin.php(254): do_action('woocommerce_pag...') #5 {main} thrown in /home/u48469p44993/domains/dev.geusdiervoeding.nl/public_html/wp-content/plugins/geusdiervoeding-wc-rxlplanner/geusdiervoeding-wc-rxlplanner.php on line 120</p>
  </blockquote>
  
  <p>I don't really see why it behaves like that, since the function is defined... Help would be appreciated.</p>
  
  <p>This is (part of) my code:</p>
  
  <pre><code>function wc_order_query()
  {   
  
      if(isset($_GET['area'])) { 
          $route = $_GET[ 'area' ];
          $date = $_GET[ 'date' ];    
  
          $args = array(
              'status' =&gt; $route,
              'meta_key' =&gt; 'jckwds_date',
              'meta_value' =&gt; $date,      
          );
          $orders = wc_get_orders( $args );
  
          if (empty($orders)) {
              echo ('&lt;ul&gt;&lt;li&gt;Op '.$date.' zijn er geen bezorgorders voor het gekozen routegebied.&lt;/li&gt;&lt;/ul&gt;');
          } else {
              routexl_generate();
          }
  
          //RouteXL API aanroepen
          function routexl_generate(){
              //Query results to API
          }
      }
  </code></pre>