Hi @bojan, I’m not sure about your last comment, because it seemed to be delayed in the discussion. I used the code in my original attempt, but it didn’t work. The devs came back with another hook, that does work, but is not in the documentation. So it looks like it was renamed and the docs need to be adjusted.
The mainwp_added_new_site hook is still in the code and the dev team believes it should be working. So if you wish, you can share your old code with us and we can take a look why it didn’t work.
I shared that code in my original post. And the complete code is available there as well (on Github).
The hook that the devs shared can’t be found in the documentation, so even if the old hook is still available, the new one is not documented yet. And I’m not sure why they both are available.
As I posted in my original message, it was just the same function that is called for editing the site, but also hooking it to the hook I mentioned. All I had to change was the name of the hook.
Hi @josklever,
Thanks for sharing the code. I also tried on my setup and confirmed that the value is not saved when the mainwp_added_new_site action is used.
To me, the code looks correct, so I passed this to our devs to check again and make sure that hook is set and documented properly.
When I have new info, I will post it.
On the other hand, it’s good to see that your custom snippet works correctly with the mainwp_site_added action.
It’s a small project to learn more about creating a plugin like this and to learn more about GitHub, but I have some more steps to go. As soon as I have some more time, I’ll add some issues to this plugin for additional features and create pull requests etc.
Ideas and contributions are always welcome!
It is very nice to see interest in custom development for MainWP. Small projects become big very fast
I looked into the original problem more, and found that the mainwp_added_new_site action hook works properly after all, but not 100% sure why it failed in first attempts.
And everything worked as expected, while adding a new site, I was able to save the Host info.
On a side note, have you thought about making the field as field-type dropdown where you can list 10-20 most popular hosts plus an “Other” option that shows option for user to add custom host?