Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions src/wp-admin/network/site-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,22 @@

$title = $blog['title'];

$meta = array(
'public' => 1,
$blog_meta = array();
if ( isset( $blog['meta'] ) ) {
foreach ( $blog['meta'] as $blog_meta_key => $blog_meta_value ) {
if ( 'blog_public' === $blog_meta_key ) {
$blog_meta['public'] = intval( wp_unslash( $blog_meta_value ) );
} else {
$blog_meta[ $blog_meta_key ] = sanitize_text_field( wp_unslash( $blog_meta_value ) );
}
}
}

$meta = wp_parse_args(
$blog_meta,
array(
'public' => 1,
)
);

// Handle translation installation for the new site.
Expand Down Expand Up @@ -262,6 +276,25 @@
</td>
</tr>
<?php endif; // Languages. ?>
<tr class="form-field">
<th scope="row">
<label>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use for attribute in the label tag? It’s better for accessibility as it links the label to the corresponding input. Like,

<label for="site-privacy-public-on">

<?php esc_html_e( 'Allow search engines to index this site' ); ?>
</label>
</th>
<td>
<fieldset>
<legend class="screen-reader-text"><?php esc_html_e( 'Site Privacy' ); ?></legend>
<label for="site-privacy-public-on">
<input name="blog[meta][blog_public]" type="radio" id="site-privacy-public-on" value="1"<?php checked( true ); ?> /> <?php echo esc_html_x( 'Yes', 'Multisite new site public privacy on' ); ?>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use dynamic check for default selection? Like:

checked( get_option( 'blog_public' ), 1 );

</label>
<br />
<label for="site-privacy-public-off">
<input name="blog[meta][blog_public]" type="radio" id="site-privacy-public-off" value="0" /> <?php echo esc_html_x( 'No', 'Multisite new site public privacy off' ); ?>
</label>
</fieldset>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="admin-email">
Expand Down