From 04c208b4214c4f1641fa05e983b713be6da278f5 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Tue, 1 Aug 2023 16:17:44 -0700 Subject: [PATCH] Ensure plugin API functions are available --- plugin.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugin.php b/plugin.php index 215eb22..07d3f61 100644 --- a/plugin.php +++ b/plugin.php @@ -182,6 +182,11 @@ function remove_my_sites_comments_menu() { return; } + // The plugin API is not always available on the front-end. + if ( ! function_exists( 'is_plugin_active_for_network' ) ) { + require_once ABSPATH . '/wp-admin/includes/plugin.php'; + } + $network_active = is_plugin_active_for_network( plugin_basename( __FILE__ ) ); foreach ( $wp_admin_bar->user->blogs as $blog ) {