The multisite_over_quota_message() WordPress PHP function displays the out of storage quota message in a Multisite environment.
Usage
To use the multisite_over_quota_message() function, simply call it in the appropriate location within your theme or plugin:
multisite_over_quota_message();
Parameters
- None
More information
See WordPress Developer Resources: multisite_over_quota_message
The multisite_over_quota_message() function is part of the WordPress core and is specifically designed for use in Multisite installations.
Examples
Display out of quota message on a custom admin page
If you are creating a custom admin page, you can use the multisite_over_quota_message() function to display the out of storage quota message if needed.
// In your custom admin page function my_custom_admin_page() { // Display out of storage quota message if applicable multisite_over_quota_message(); // Your admin page content here }
Display out of quota message on a custom template
If you want to display the out of storage quota message on a specific template in your theme, you can use the multisite_over_quota_message() function.
// In your custom template get_header(); multisite_over_quota_message(); // Your template content here get_footer();
Display out of quota message on a shortcode
You can create a shortcode that displays the out of storage quota message using the multisite_over_quota_message() function.
// Create a shortcode to display the out of storage quota message function my_quota_message_shortcode() { ob_start(); multisite_over_quota_message(); return ob_get_clean(); } add_shortcode('my_quota_message', 'my_quota_message_shortcode');
Display out of quota message using a Gutenberg block
Create a custom Gutenberg block that displays the out of storage quota message using the multisite_over_quota_message() function.
// Register the custom Gutenberg block function my_quota_message_block() { wp_register_script( 'my-quota-message-block', get_template_directory_uri() . '/my-quota-message-block.js', array( 'wp-blocks', 'wp-element', 'wp-editor' ) ); register_block_type( 'my-theme/my-quota-message', array( 'editor_script' => 'my-quota-message-block', 'render_callback' => 'my_quota_message_block_callback', )); } add_action( 'init', 'my_quota_message_block' ); // Block callback function function my_quota_message_block_callback() { ob_start(); multisite_over_quota_message(); return ob_get_clean(); }
Display out of quota message using a widget
Create a custom widget that displays the out of storage quota message using the multisite_over_quota_message() function.
class My_Quota_Message_Widget extends WP_Widget { public function __construct() { parent::__construct( 'my_quota_message_widget', 'My Quota Message Widget', array( 'description' => 'A widget to display the out of storage quota message.' ) ); } public function widget( $args, $instance ) { echo $args['before_widget']; multisite_over_quota_message(); echo $args['after_widget']; } } add_action( 'widgets_init', function() { register_widget( 'My_Quota_Message_Widget'