upload_space_setting() WordPress Function

This function allows you to change the default upload space for your WordPress site. By default, WordPress sets the maximum upload space to 2MB. However, you can change this setting by using the upload_space_setting() function. This function takes two parameters: the maximum upload space (in megabytes) and the minimum upload space (in megabytes). For example, you can use the following code to change the default upload space to 5MB: upload_space_setting(5); You can also use this function to change the minimum upload space. For example, you can use the following code to change the minimum upload space to 1MB: upload_space_setting(1,5);

upload_space_setting( int $id ) #

Displays the site upload space quota setting form on the Edit Site Settings screen.


Parameters

$id

(int)(Required)The ID of the site to display the setting for.


Top ↑

Source

File: wp-admin/includes/ms.php

function upload_space_setting( $id ) {
	switch_to_blog( $id );
	$quota = get_option( 'blog_upload_space' );
	restore_current_blog();

	if ( ! $quota ) {
		$quota = '';
	}

	?>
	<tr>
		<th><label for="blog-upload-space-number"><?php _e( 'Site Upload Space Quota' ); ?></label></th>
		<td>
			<input type="number" step="1" min="0" style="width: 100px" name="option[blog_upload_space]" id="blog-upload-space-number" aria-describedby="blog-upload-space-desc" value="<?php echo $quota; ?>" />
			<span id="blog-upload-space-desc"><span class="screen-reader-text"><?php _e( 'Size in megabytes' ); ?></span> <?php _e( 'MB (Leave blank for network default)' ); ?></span>
		</td>
	</tr>
	<?php
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.