site_admin_notice() WordPress Function

The site_admin_notice() function is used to display a notice to the site administrator. This function can be used to display an error message, a warning message, or a general notice. The message will be displayed in the WordPress admin interface.

site_admin_notice() #

Displays an admin notice to upgrade all sites after a core upgrade.


Return

(void|false) Void on success. False if the current user is not a super admin.


Top ↑

Source

File: wp-admin/includes/ms.php

function site_admin_notice() {
	global $wp_db_version, $pagenow;

	if ( ! current_user_can( 'upgrade_network' ) ) {
		return false;
	}

	if ( 'upgrade.php' === $pagenow ) {
		return;
	}

	if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) {
		echo "<div class='update-nag notice notice-warning inline'>" . sprintf(
			/* translators: %s: URL to Upgrade Network screen. */
			__( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ),
			esc_url( network_admin_url( 'upgrade.php' ) )
		) . '</div>';
	}
}


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.