title: How do I get the site id in the same function that created the site?
body: <p>I'm writing some php functions to work off of endpoints, specficially one that takes the input of a form to create a site within a wp multi-site. In terms of progress, the code below will take the input and create a site with the correct path and domain, but none of the meta information is being added.</p>
  <pre><code>  public function create_endpoint($request) {
          $key = $request['key'];
  
  //Capturing user-input from form 
          if ($this-&gt;validate_key($key)) {
                $title = $request['name'];
                $slug = $request['slug'];
                $admin_user = $request['admin_user'];
                $site_owner = $request['site_owner'];
                $site_ouc = $request['site_ouc'];
                $registered = $request['registered'];
                $service_tier = $request['service_tier'];
                $service_offering = $request['service_offering'];
                
  //Site creation process
                  $domain = 'localhost';
                  $path = 'wordpress/'.$request['slug'];
  
                  $user_id = get_user_by( 'login', $this-&gt;admin_user );
  
                  $network_id = get_network()-&gt;id;
  
                  if ( !empty($title) and !empty($domain) and !empty($path) ) {
                    wpmu_create_blog($domain, $path, $title, $user_id);
  
  
                    $site_id = get_blog_id_from_url( $domain, $path);
  
                    //Adding in meta-data
                        update_site_meta( $site_id, 'site_owner' , $site_owner);
                        update_site_meta( $site_id, 'site_ouc' , $site_ouc);
                        update_site_meta( $site_id, 'registered' , $registered);
                        update_site_meta( $site_id, 'service_tier' , $service_tier);
                        update_site_meta( $site_id, 'service_offering' , $service_offering);
  
                    return $site_id;
  
                  }
                  else {
                    return &quot;Not enough information&quot;;
                  }
  
          }
           else {
              return $this-&gt;invalid_key_message;
          }
      }
  </code></pre>
  <p>The root problem being that when I return the <code>$site_id</code> I always get <code>0</code>, so the <code>update_site_meta</code> functions have nothing to work with.</p>
  <pre><code>if ( !empty($title) and !empty($domain) and !empty($path) ) {
                    wpmu_create_blog($domain, $path, $title, $user_id);
  
                    return $site_id;
  </code></pre>
  <p>Any insight or thoughts are welcome, I have been working against a wall.</p>