WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies()

In this article

Displays an admin notice if dependencies are not installed.

Source

public static function display_admin_notice_for_unmet_dependencies() {
	if ( in_array( false, self::get_dependency_filepaths(), true ) ) {
		$error_message = __( 'Some required plugins are missing or inactive.' );

		if ( is_multisite() ) {
			if ( current_user_can( 'manage_network_plugins' ) ) {
				$error_message .= ' ' . sprintf(
					/* translators: %s: Link to the network plugins page. */
					__( '<a href="%s">Manage plugins</a>.' ),
					esc_url( network_admin_url( 'plugins.php' ) )
				);
			} else {
				$error_message .= ' ' . __( 'Please contact your network administrator.' );
			}
		} elseif ( 'plugins' !== get_current_screen()->base ) {
			$error_message .= ' ' . sprintf(
				/* translators: %s: Link to the plugins page. */
				__( '<a href="%s">Manage plugins</a>.' ),
				esc_url( admin_url( 'plugins.php' ) )
			);
		}

		wp_admin_notice(
			$error_message,
			array(
				'type' => 'warning',
			)
		);
	}
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.