WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies
Displays an admin notice if dependencies are not installed.
Method of the class: WP_Plugin_Dependencies{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies();
Changelog
| Since 6.5.0 | Introduced. |
WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies() WP Plugin Dependencies::display admin notice for unmet dependencies code WP 6.9.1
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',
)
);
}
}