paused_plugins_notice()WP 5.2.0

Renders an admin notice in case some plugins have been paused due to errors.

No Hooks.

Return

null. Nothing (null).

Usage

paused_plugins_notice();

Notes

  • Global. String. $pagenow The filename of the current screen.
  • Global. WP_Paused_Extensions_Storage. $_paused_plugins

Changelog

Since 5.2.0 Introduced.

paused_plugins_notice() code WP 6.5.2

function paused_plugins_notice() {
	if ( 'plugins.php' === $GLOBALS['pagenow'] ) {
		return;
	}

	if ( ! current_user_can( 'resume_plugins' ) ) {
		return;
	}

	if ( ! isset( $GLOBALS['_paused_plugins'] ) || empty( $GLOBALS['_paused_plugins'] ) ) {
		return;
	}

	$message = sprintf(
		'<strong>%s</strong><br>%s</p><p><a href="%s">%s</a>',
		__( 'One or more plugins failed to load properly.' ),
		__( 'You can find more details and make changes on the Plugins screen.' ),
		esc_url( admin_url( 'plugins.php?plugin_status=paused' ) ),
		__( 'Go to the Plugins screen' )
	);
	wp_admin_notice(
		$message,
		array( 'type' => 'error' )
	);
}