Skip to content
Advertisement

How do I get the site id in the same function that created the site?

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.

JavaScript

The root problem being that when I return the $site_id I always get 0, so the update_site_meta functions have nothing to work with.

JavaScript

Any insight or thoughts are welcome, I have been working against a wall.

Advertisement

Answer

Looking at he docs it seems wpmu_create_blog should return the blog id… so you could update that part of your code to below:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement