The network_site_new_form WordPress action fires at the end of the new site form in the network admin.
Usage
add_action('network_site_new_form', 'your_custom_function_name'); function your_custom_function_name() { // your custom code here }
Parameters
None
More information
See WordPress Developer Resources: network_site_new_form
Examples
Add a custom input field to the new site form
This example adds a custom input field called “Site Owner Email” to the new site form in the network admin.
add_action('network_site_new_form', 'add_custom_site_owner_email_field'); function add_custom_site_owner_email_field() { echo '<label for="site_owner_email">Site Owner Email:</label>'; echo '<input type="email" name="site_owner_email" id="site_owner_email">'; }
Display a notice after the new site form
This example displays a notice after the new site form in the network admin, reminding admins to set up an email address for the new site owner.
add_action('network_site_new_form', 'display_notice_after_new_site_form'); function display_notice_after_new_site_form() { echo '<p><strong>Reminder:</strong> Please set up an email address for the new site owner.</p>'; }
Add custom instructions to the new site form
This example adds custom instructions at the end of the new site form in the network admin.
add_action('network_site_new_form', 'add_custom_instructions_to_new_site_form'); function add_custom_instructions_to_new_site_form() { echo '<p><strong>Instructions:</strong> After creating the site, please add the necessary plugins and themes.</p>'; }
Add a checkbox for GDPR compliance
This example adds a GDPR compliance checkbox to the new site form in the network admin.
add_action('network_site_new_form', 'add_gdpr_compliance_checkbox'); function add_gdpr_compliance_checkbox() { echo '<label for="gdpr_compliance">'; echo '<input type="checkbox" name="gdpr_compliance" id="gdpr_compliance">'; echo 'I confirm that the new site will be GDPR compliant.</label>'; }
Add a custom select field for site type
This example adds a custom select field called “Site Type” to the new site form in the network admin.
add_action('network_site_new_form', 'add_custom_site_type_field'); function add_custom_site_type_field() { echo '<label for="site_type">Site Type:</label>'; echo '<select name="site_type" id="site_type">'; echo '<option value="blog">Blog</option>'; echo '<option value="ecommerce">E-commerce</option>'; echo '<option value="portfolio">Portfolio</option>'; echo '</select>'; }